Loading default value in a dropdown and calling onchange event
Posted
by
J. Davidson
on Stack Overflow
See other posts from Stack Overflow
or by J. Davidson
Published on 2013-11-03T09:41:03Z
Indexed on
2013/11/03
9:53 UTC
Read the original article
Hit count: 249
Hi i have following dropdown
<div class="fcolumn">
<label class="text" for="o_Id">Months:</label>
<select class="textMonths" id="o_Id" name="periodName" >
<option value="000">Select Period--</option>
</select>
</div>
In the following jquery, first it loads fnLoadP() in a drop down list. Than as a default I am loading one of the values in drop down which is '10'. It loads too as default value. But it should be executing $("#o_Id").change.. which it doesn't.
$(document).ready(function () {
var sProfileUserId = null;
$("#o_Id").change(function () {
//----
});
fnLoadP();
$("select[name='pName']").val('10');
});
});
Basically my goal is. After dropdown values are loaded, to load '10' as default value and call onchange event in the dom. Please let me know how to fix it.
© Stack Overflow or respective owner