Why won't this give an alert? I need to make it work without JQuery and with the "button" element since the button is being auto-generated. It works if I put the javascript inside the quotes, but I want to call a function.
<button onclick='test()' >click</button>
javascript
function test()
{
alert('hi');
}

onloadhandler, which excludestestfrom the global scope.