I have a select
element and a button
.
When the option from the select element is changed, it evokes some function:
<select id="mySel" onchange="someFunction();">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
...
</select>
<input type="button" value="Click" onclick="document.getElementById('mySel').selectedIndex = 0;"/>
someFunction()
is only evoked when I change the option from the select element itself, not when I click the button.
What I'm trying to do is to get the select element onchange event to fire regardless where the option is being changed from.
I know that I can add someFunction()
to the button onclick event, but that's not what I'm looking for.
Any ideas will be appreciated.