Javascript click event fired twice, already stopping proagation -


I have a very strange problem, but I can not repeat it here, because I do not know what it is, and This is a 200+ line part of the JS file, I will explain it at its best:

My problem is in relation to the DOM manipulation, I am just using vanilla javascript.

I have an element a , when you click on it, a function is triggered to show the content of a divis, I just addEventListener ('Click', function () {...}, false) . Does it work.

On the same page, I have the same status, B . Problem here: Once I clicked on B , whenever I click on A , the click element is removed twice, on Google Have searched, but I found that only the results were talking about the need to stop the promotion of the event.

I am doing this already.

This is strange, that the problem is only once when I first click on B , otherwise it works perfectly.

Any thoughts? Please ask any questions you need to understand the problem better.

Thanks to everyone for the comments ideas. @ Stefanby suggested that the ceremony is being started twice:

I am using angular to include the material (this is a partial view), so I have the $ IncludeContentLoaded to start the listening function for the event event. When clicking on

b , I included new content, which resulted in $ includcontentLoaded was removed again.

How did I solve the problem:

  var page included = true; // When the controller is loading the scope of $. {If (pageIncluded) {// Inissialize function pageIncluded = false;}} on $ ('$ IncludeContentLoaded', function)  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -