I know that you can use the "onChange" method, but the onChange doesn't get fired if I change the value by code, like this :
<select id='selectBox' onChange='alert("changed")'>
<option value="1">1</option>
<option value="1">2</option>
<option value="1">3</option>
<select>
<script>
$(document).ready(function() {
$('#selectBox').val('3');
});
</script>
When the document loads, I would like the alert "changed" to popup... Is this possible?
You could try firing the change event manually, like so:
$('#selectBox').val('3').change();
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