开发者

append after checkbox button, if select.value=enumType

开发者 https://www.devze.com 2022-12-22 06:30 出处:网络
$(\'#types\').change(function() { var htmlToAppend = \"<br/><input id=\'btnAddDictionary\' type=\'button\'开发者_开发技巧 value=\'Add Dictionary\' />\";
      $('#types').change(function() {
            var htmlToAppend = "<br/><input id='btnAddDictionary' type='button'开发者_开发技巧 value='Add Dictionary' />";
            if ($("#types").val() == 'enumType') {
                $(this).append(htmlToAppend); //problem is in there
                debugger;
            }
            else {
                //removebutton or not show it
            }
        });


Try this:

  $('#types').change(function() {
        var htmlToAppend = "<br/><input id='btnAddDictionary' type='button' value='Add Dictionary' />";
        if ($(this).val() == 'enumType') {
            $(this).after(htmlToAppend);
            debugger;
        }
        else {
            $(this).next('br').remove();
            $(this).next('#btnAddDictionary').remove();
        }
  });
0

精彩评论

暂无评论...
验证码 换一张
取 消