jQuery: Test if jQuery is loaded
jQuery Practical exercise Part - I: Exercise-1
Test if jQuery is loaded.
Sample solution:
HTML Code:
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>Test if jQuery is loaded</title>
</head>
<body>
<p>Click me!</p>
</body>
</html>
JavaScript Code :
$("p").bind("click", function(){
$( "This is a click Event").appendTo( "body" );
});
$("p").bind("dblclick", function(){
$( "This is a double-click Event" ).appendTo( "body" );
});
See the Pen jquery-practical-exercise-1 by w3resource (@w3resource) on CodePen.
Contribute your code and comments through Disqus.
Previous: jQuery Practical exercises
Next: Scroll to the top of the page with jQuery.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/jquery-exercises/part1/jquery-practical-exercise-1.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics