It works on jquery 1.3 but when I try to replace it with 1.8 I get the “unsupported pseudo: all” error:
Here is my current code:
$(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");
});
});
Your answers would be of great help.
I think you want
$('select[id$=DDL] option')or$('select[id$=DDL] *')or$('select[id$=DDL]').children()