jamiya / jquery-option-tree

Automatically exported from code.google.com/p/jquery-option-tree
0 stars 0 forks source link

preselect is set even when it has not changed spawning change events #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. create an input with value "foo"
2. add a change handler
3. tie optionTree() to the input with a preselect setup to set "foo"
4. optionTree() will set foo again triggering the input's change handler

I don't believe optionTree() should trigger an input change event unless the 
value actually changes.

I'm running:

* jQuery optionTree Plugin
* version: 1.3

with jQuery 1.10.2.

A patch is attached which just checks the current value of the input against 
the new value before setting.

    var setValue = function (name, value) {
        var input = $("input[name='" + cleanName(name) + "']");
        if(input.val() != value)
            input.val(value).change();
    };

Original issue reported on code.google.com by aric.cza...@gmail.com on 9 Jan 2014 at 10:17

Attachments: