Why Does The Asp.net Dropdownlist Does Not Default To 0 If Chosen Jquery Is Used
I was using the Chosen Jquery which causes the dropdownlist to not update. This is the HTML:
Solution 1:
Try something like this:
<select name="ctl00$BodyPlaceHolder$ddl1" id="ddl1" class="chose-select le">
<option value="" disabled selected>Select a State</option>
<option value="Alabama">AL</option>
<option value="Alaska">AK</option>
<option value="Arizona">AZ</option>
</select>
Solution 2:
just add data-placeholder="Choose a State"
to be like that
<select name="ctl00$BodyPlaceHolder$ddl1" id="ddl1" data-placeholder="Choose a State" class="chose-select le">
<option value="Alabama">AL</option>
<option value="Alaska">AK</option>
<option value="Arizona">AZ</option>
</select>
Solution 3:
I had to remove the .val(0)
and it worked fine.
$(ddl1).trigger('chosen:updated');
Post a Comment for "Why Does The Asp.net Dropdownlist Does Not Default To 0 If Chosen Jquery Is Used"