I’m trying to add some tags in a from the js code
I found an interesting function in jquery: append x)
I got this in my .js:
function goClick(target) {
}
function clickChapDiv(event) {
$(event.currentTarget.parentNode).append("<span> <img src=\"../images/popUp.png\" /> <span class=\"textPopUp\"> <span class=\"notePopUp\">B-</span> <span class=\"titlePopUp\"> 3-JE TESTES </span> <img src=\"../images/minigo.png\" class=\"buttonPopUp\" onclick=\"goClick(this);\" /> </span>");
}
But this isn’t working, if i remove the onclick=\”goClick(this);\”, it’s working but there is no event on the (normal…)
Is someone has an idea of my problem ? cause i saw some code on internet with onclick event in the .append and their code was working…
Thanks for your futur answers
Here is your code below. it is not fully closed which may be causing your problem
Add the extra span at the end.
Also you need to bind the click event when the element is added to the DOM.
Instead you want to use
.live. See here.