I wrote JavaScript in separate file now i want to use a function written in that .js file
HTML
<html lang="en">
<head>
<title>try</title>
</head>
<body onload="hide()" >
<div id="final">
<p> Hello World</p>
</div>
<script src="js/userFunction.js"></script>
</body>
</html>
JS File
function hide(){
$("#final").hide();
}
its not working, please suggest
$is not a built-in JavaScript or DOM function. You also have to include whatever script provides that function (presumably jQuery). If you indeed intend to use jQuery, please follow the jQuery tutorial. It includes everything you need to know to get started.