I don't have many knowlege in javascript so I don't know what is the problem here, I create divs dynamically in js and each div call a function when is clicked but the function is not recongized. This is part of the code
for (......) { var listatema = document.createElement("div"); listatema.innerHTML += "<a href='javascript: void(0)' onClick='functest(" + pag + ")'>" + temat + "</a>"; document.getElementById('menu').appendChild(listatema);} } "tema" is a text, the function "functest" has an argument "pag[aux]", this is a number.
The function is:
function functest(arg){ console.log(arg) } other alternative that i tried is change that: onClick='"+ functest(pag) +"':
i change the position of Quotation marks "" and the function work good but it is executed when the page is loaded, it don't wait to do click.