Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Init Method on each Element

$
0
0
I created a version that is annotated with explanations and fixes. Here's a short-form version of the weird stuff in this code:

1) new only returns a single instance, so only one Control is created and that is on the first matched element
2) init gets a jQuery element using that same selector from the Constructor which gives you both <div> elements. Really you should be using this.element instead
3) this.p is modified in the event handlers instead of el. Not sure why you would want to do this.



Viewing all articles
Browse latest Browse all 3491

Trending Articles