Create options of a select element dynamically - JQuery Mobile
I have created options for select list dynamically. When i tried to add options dynamically through jquery it works properly but i want show first item to be selected which is not working. But if i specified it hard coded then it will automatically take first option as a default.
- <select id="Domain" data-shadow="true" data-mini="true">
</select>
- <script type="text/javascript">
$(document).ready(function () {
$("#Domain").append($("<option>").attr("value", "0").text("---Select Field Name---"));
});
</script>