Awesome q2a theme

What is the logic of the work of the DOM while adding and removing handlers in my case?

0 like 0 dislike
Prepared sample of codepan.
The problem is the following:
Add an element in the DOM with class user-button at the same time want to hang the handler click on all the items user-button, not hung several handlers after each function call, I removed the handler for the click each item and then add again, but something is not removed as I want.

ie every time I click on + the handler is still added to the previous items, do not understand how the DOM works.
Pliz explain!
PS well, or if you know another solution I would be glad to hear :)
by | 62 views

1 Answer

0 like 0 dislike
Nonsense some do. Use delegation. For example, so.

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
40,796 users