javascript - Hide() in jquery doesn't work -
code in index.html
<head> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/index.js"></script> </head> <body onload="loadindex()"> <a id="registration" href="register.html"> register </a> </body>
code in index.js
function loadindex() { alert("page loaded"); $("#registration").hide(); }
i alert, link not hidden. have more files, , not work in of them. think mistake not in code, don't know is.
your code fine exception of tiny syntax issue. you're missing closing tag </head>
. check code below:
function loadindex() { alert("page loaded"); $("#registration").hide(); }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <head> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/index.js"></script> </head> <body onload="loadindex()"> <a id="registration" href="register.html"> register </a> </body>
Comments
Post a Comment