它适用于 jquery 1.3,但是当我尝试用 1.8 替换它时,我得到“不支持的伪:全部”错误:
这是我当前的代码:
$(function () {
$('input[id$=btnAdd]').click(function (e) {
e.preventDefault();
// Assuming you get a JSON object from a service
var lenBefore = $('select[id$=DDL] :all').length;
var obj = { "6": "Item6", "7": "Item7", "8": "Item8" };
$.each(obj, function (value, text) {
$('select[id$=DDL]').append($('<option></option>').val(value).html(text))
});
var lenAfter = $('select[id$=DDL] :all').length;
$("#para").html("<b>" + (lenAfter - lenBefore) + "</b>" + " new items were added");
$(this).attr("disabled", "disabled");
});
});
先生/女士,您的回答会很有帮助。谢谢++