I have a select box and I need to both set the selected value and issue a change event with javascript.
In Firefox, the following works with no problem:
Y.one('#my_select_box').set('value', STEP_VALUES);
Y.one('#my_select_box').simulate('change');
No such luck in IE (IE7 in this case). The selected's value does not even change. I have tried using 'selectedIndex' instead of 'value' too.
Any ideas?
A reasonable answer is mySelect.query('option[value=foo]').set('selected', true);
, however according this ticket it looks like the set('value', value)
approach should work on the select tag itself, so I'm still unsure about that (I'm using YUI 3.1.1), so I'm still interested in any comments.