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

Access to element during onChange callback #48

Merged
merged 1 commit into from
Aug 1, 2014

Conversation

patrickgalbraith
Copy link
Contributor

It would be great to have access to either the select element or the minimalect instance during the onChange callback. Currently the scope of the callback is the settings object which means it isn't possible to know which select the callback is for.

Simple example:

$("select").minimalect({
   onchange: function(value, text) {
       this.element // undefined
   }
});

I've attached a pull request with the thisRef updated but you could also just pass the element reference through as an additional parameter.

groenroos added a commit that referenced this pull request Aug 1, 2014
Access to element during onChange callback
@groenroos groenroos merged commit 5661725 into groenroos:master Aug 1, 2014
@groenroos
Copy link
Owner

Good point! Merged. Will have to update the minified version once I have the time.

@patrickgalbraith
Copy link
Contributor Author

Thanks ;)

Also might be worth looking to see if it make sense to update any of the other callbacks. I'll leave that up to your discretion since onchange is the only one I use.

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

Successfully merging this pull request may close these issues.

2 participants