How to fire a change event on a HTMLSelectElement if the new value is the same as the old?

The Solution to How to fire a change event on a HTMLSelectElement if the new value is the same as the old? is


I'd do it like this:

<select onchange="jsFunction()">
  <option value="" disabled selected style="display:none;">Label</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
</select>

If you want you could have the same label as the first option, which in this case is 1. Even better: put a label in there for the choices in the box.

~ Answered on 2012-08-09 06:04:09


Most Viewed Questions: