Hello everyone, i want whenever in my dropdown ( select box) , if any user select more than two values then alert message should display. Tell me validation on html select dropdown list selection using the jQuery function
how can i do this ?
Validation for HTML dropdown list selection using the jQuery function
Share
You can achieve multiple select value using the jQuery function. Below is the jQuery function.
<script type='text/javascript'>
$(document).ready(function(){
$('#transactionType').click(function(){
var foo = [];
$('#transactionType :selected').each(function(i, selected){
foo[i] = $(selected).text();
});
alert(foo);
});
});
</script>
And you can use the below code for the multiple select box.
<select id="transactionType" name="multiselector" multiple>
<option value="Value00">Value 00</option>
<option value="Value11">Value 11</option>
<option value="Value22">Value 22</option>
<option value="Value33">Value 33</option>
<option value="Value44">Value 44</option>
</select>