Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Check for multiple instances on one element (problem!) #23

Open
skorth opened this issue Oct 13, 2012 · 1 comment
Open

Check for multiple instances on one element (problem!) #23

skorth opened this issue Oct 13, 2012 · 1 comment

Comments

@skorth
Copy link

skorth commented Oct 13, 2012

I add my input fields dynamically to the dom, or if there is already data i have multiple fields given. All of them using the same class. If i now bind the plugin on these elements it cause problems. I like the pattern to use 'data' to check if the plugin already exists on an element.

I did it like this...

return this.each(function(i) {
if($(this).data("smart-autocomplete")){
return something....
} else {
init events.....
}
}

Would be cool to have this, especially for event driven plugins :-)

@skorth
Copy link
Author

skorth commented Oct 13, 2012

Mh, sorry. Even this doens't work propper :-(

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

No branches or pull requests

1 participant