3
我试图从下拉列表中重新启用选定和禁用选项,一旦它们从添加列表中“删除”。 任何人都可以帮助我。提前谢谢了。 以下是我到目前为止,并在这里http://jsfiddle.net/N2jyy/2/演示页面。jQuery:重新启用选择和禁用选项
$(document).ready(function() {
$('#Add-btn').live('click',function() {
$(document.body).append($("<div>"));
var a = $('#a').val();
$("#tabName tr:first").before("<tr><td class='greyed'><input type='hidden' name='added_a' value='" + a + "'>" + a + "</td><td style='background:transparent;'><input type='button' class='delete' value='Remove'></td></tr>");
$("#a option:selected").attr("disabled", true);
});
$('#tabName td .delete').live('click',function() {
// here I want to re-enable the select option ...removeAttr('disabled');
$(this).parent().parent().remove();
return false;
});
});
真棒!谢谢,尼克。 – DGT 2010-08-13 18:40:59
我更喜欢这个,但发布我的替代方式:) – 2010-08-13 18:55:26