pjsikora / select-box

Automatically exported from code.google.com/p/select-box
1 stars 0 forks source link

onChange event triggers even when there is no change #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The onChange event fires even if the option is not changed. This is not the 
expected behavior, the event should only fire when the value actually changes.

http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3
onchange = script [CT]
The onchange event occurs when a control loses the input focus and its value 
has been modified since gaining focus. This attribute applies to the following 
elements: INPUT, SELECT, and TEXTAREA.

What steps will reproduce the problem?
1. <select>
<option>one
<option>two
<option>three
</select>
<script>
$("select").selectbox({
  onChange: function(v,i) {
    alert("changeto: "+v);
  }
});
</script>

2. Click the dropdown and select the option equivalent to the option already 
shown.

example here: http://jsfiddle.net/SQq9r/

What is the expected output? What do you see instead?
When selecting an option from the dropdown that is equal to the already 
selected item nothing should happen. Instead you will get an alert of the 
selected item.

What version of the product are you using? On what operating system?
0.1.3

Original issue reported on code.google.com by tbart...@gmail.com on 27 Jul 2011 at 12:48