Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Aug 12, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 9 Jan 2014 at 10:17

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant