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.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics