$('#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();
}
});
精彩评论