$('#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
}
});
答案 0 :(得分:1)
试试这个:
$('#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();
}
});