5
I’m trying to make the delegation an event click
There is a link within a table, how this jsFiddle example shows:
The result obtained as you can see, is:
- By clicking on the link "Activate", the event
click
assigned to the class.activate
is fired, thus changing the class of the same link to.deactivate
. - By clicking on the link "Deactivate", the event
click
assigned to the class.activate
is fired again but nothing happening, and the correct would be the execution of the eventclick
changing again its class to.activate
.
For a better understanding, please open the link to jsFiddle.
Taking some examples that I had already done, and researching cases similar to mine, I discovered that I should delegate the event as follows:
$(document).on("click", "#element", function (e) {});
However I did not get the expected result, as you can see in this other jsFiddle example.
I am available to add further information if necessary.
Thank you very much, it worked perfectly for me!
– Thomerson Roncally