SyntaxFix
Write A Post
Hire A Developer
Questions
Try:
document.getElementById("foo").onclick = function (){alert('foo');};