Powered by Blogger.

Adding Options to Select Tag Using jQuery


By using jquery we can easily add options to select tag.

jQuery

$("#select").append($("<option></option>").val(1).html("One"));
$("#select").append($("<option></option>").val(2).html("Two"));
$("#select").append($("<option></option>").val(3).html("Three"));

=========================================================

HTML

<select id="select">
</select>

Demo

No comments