I have a .js file with:
function date()
{
document.getElementById("id1").innerHTML = Date();
}
And a page with:
<p id="id1"></p>
<button type="button" onclick="date()">Click here</button>
But clicking on it doesn't do anything. What's missing?
just add
<script type='text/javascript' src="path_to_js_file"></script>
on top of your html page