When I submit the form, page is refresh it self regardless of jquery codes I’ve wrote. Can anyone point me to where I have been wrong?
My html file:
<html>
<head>
<script type="text/javascript" src="./js/up.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<form id="up" action="" method="post">
<input id="image" type="text" name="file"/><input id="submit" type="submit"/>
</form>
</body>
</html>
my javascript file
$(document).ready(function(){
$('input#submit').click(function(){
alert('hi');
/*some codes goes here*/
});
});
When the page loads, console display this error: Uncaught ReferenceError: $ is not defined even i didn’t call any jquery functions.
You’ll need to include your jQuery dependent scripts after jQuery:
And you should only have one jQuery file.