I have a foreach loop and I'm writing some href(s) with DOM:
var href = document.createElement("a"); href.setAttribute("href", uid); Basically I have X href and I want a javascript function fired when a user click on a href.
I tried to do add a onclick event...
href.setAttribute("onclick","displayer("+uid+");"); The uid variable:
var uid = String(Nuid); even if is a string, and I can clearly see that in Firebug is ok (console.log)
But when I click on that link Firebug says:
wall.php:1 Uncaught ReferenceError: hEIsrMeIN4M5OoLYTlGUQg9paL73 is not defined and it points me to <!DOCTYPE HTML> which is not the error.
The Javascript function is nothing special...
function displayer(uid){ window.alert(uid); }
href.setAttribute("onclick","displayer('"+uid+"');");