Tuesday, 18 October 2011

Adding a new Item to a DropDown using Jquery.

Use any one of the Technique to add an item to a 
drop-down control:


$('#Coupon_Cities').append("<option value="-1">"All Cities"</option>");

OR

$('#Coupon_Cities').append($("<option></option>").val("-1").html("All Cities"));

OR 


$('#Coupon_Cities').append(new Option("All Cities", -1));
 
OR  
 
$("<option value=’-1’>All Cities </option>")
                                   .appendTo("#Coupon_Cities"); 




No comments:

Post a Comment