Reputation: 55
I want to add the following jquery in external javascript file.
$("a[href='#c4']").click(function() {
$("html, body").animate({ scrollTop: 0 }, 2500);
return false;
});
});
How to execute this in html file?.Help me...
Upvotes: 0
Views: 653
Reputation: 530
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Hello World</h1>
<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/your/jsFile.js"></script>
</body>
</html>
Upvotes: 1
Reputation: 4218
First include jquery file in your html and then just include your external file after your jquery file in your html page like this:
<head>
<script src="your_jquery_file.js"></script>
<script src="yourexternalfile.js"></script>
</head>
Upvotes: 1