I am trying to read the value of the selectedID in a drop down list in html through jQuery but it keeps producing an error. Did I miss something?
<select style="width: 80px;" class="text ui-widget-content ui-corner-all" id="metaList">
<option value="4d5e3a8c4184开发者_如何学编程16ea16000000">Wikipedia</option>
<option value="4d5e3a8c418416ea16010000">Twitter</option>
<option value="4d5e3a8c418416ea16020000">DBPedia</option>
<option value="4d64cd534184162629000000">test</option>
</select>
I tried which used to work before
var temp = $("#metaList").val();
but it produces NULL!
Your function call is correct, but nothing is selected. That is the reason why NULL
is returned.
Try:
var temp = $("#metaList option:selected").val();
精彩评论