I have a snippet where a customer presses a button on the webpage.
This button should select an option in a hidden select box and update a few hidden fields on the page. It works on all platforms and browsers accept on Safari on the Mac.. the dropdown does not get updated.
Tracked it down to
$('#selectSize option[id=Bespoke]').attr('selected', 'selected');
The dropdown does not update but everything else works - only on Safari on the Mac.
Fiddle is here: http://jsfiddle.net/XPD25/10/
You can use .prop instead:
$('#selectSize option[id=Bespoke]').prop('selected', true);
Also, IDs are unique so there is no need for the additional bits in the selector:
$("#Bespoke").prop("selected", true);
try this
$('#selectSize option[id=Bespoke]').prop('selected', true);
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