I have a dropdown menu for states. The first option is 'Please select state' and its value is 0 but a state is always selected it as the user picks a state from a previous page and it somehow gets state and selects it. I want it to be at value 0.
I have this code....
$('#shipstate option').attr('selected', '');
but this sets all my options to selected.
What Am I doing wrong?
You want to set the value of an element that happens to be a select to 0, now turn this phrase into jquery:
$('#shipstate').val(0)
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