hi I have tried many options to check if the multiple attribute is set in my select box but none have worked. I am trying to determine if the current select box that I am getting values from is a multiple select so far this is what I have tried:
if($(":select[multiple]").length){
alert("worked");
}
also
if($("select").attr("multiple"){
alert("worked");
}
also
if($("select").attr("multiple") != 'undefined'{
alert("worked");
}
html:
<select multiple="multiple" style="height:50px" class="classname" name="multi_values[]">
<option value="blah">blah</option>
<option value="blah">blah</option>
<option value="blah">blah</option>
</select>
remove :
at the beginning of :
if($("select[multiple]").length){
alert("worked");
}
Demo : http://jsfiddle.net/D5JX5/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With