Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not set the selected property JQuery. JQuery Dropdown

The following code will not work for me in ie6 but unsurprisingly, it does work in every other browser:

$('#myDropdown').val('value');

I have no idea why this is happening.

Any thoughts?

like image 607
dagda1 Avatar asked Jan 23 '26 04:01

dagda1


1 Answers

You probably need to do something like

$("#myDropdown > option[selected]").removeAttr("selected");
$("#myDropdown > option[value='value']").attr("selected","selected");

Just a guess.

like image 59
Mark Avatar answered Jan 25 '26 18:01

Mark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!