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

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

Comments

Projects
None yet
1 participant

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 commented Oct 13, 2012

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

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