External JavaScripts in HTML head
This code inside the head in the HTML
<script>
$(document).ready(function(){
<!-- jQuery code goes here -->
});
</script>
Complete comde with the HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#toggleTBN").click(function(){
$("#toggleText").toggle();
});
});
</script>
</head>
<body>
<button id="toggleTBN">Toggle Text</button>
<h1 id="toggleText">Clicke Toggle Text to toggle this text !</h1>
</body>
</html>
18 Related pages
- Date and Time JavaScript
- Display Date, JavaScripts
- Display Date, JS
- External JavaScripts in HTML head
- JavaScript confirm OK and Cancel
- JavaScript Promise API
- JavaScript redirect to
- JavaScript toggle class
- JS alert in php
- JS Blinking Text
- JS Date
- JS display image preview on the form before submit
- JS image inside ul li
- JS Numeric Sort
- JS prevent form resubmission
- JS, pop( ) remove last element in the array
- JS, push() adds to the last element in the array
- Timeout JS
























