What is
jQuery?
jQuery is a fast, small, and feature-rich
JavaScript library. It makes things like HTML document traversal and manipulation,
event handling, animation and Ajax much simpler with an easy-to-use API that
works across a multitude of browsers. With a combination of versatility and
extensibility, jQuery has changed the way that millions of people write
JavaScript. jQuery also simplifies a lot of the complicated things from
JavaScript, like AJAX calls and DOM manipulation.
The jQuery library contains the following
features:
- CSS manipulation
- HTML event methods
- HTML/DOM manipulation
- Effects and animations
- AJAX
- Utilities
The jQuery team knows all about
cross-browser issues, and they have written this knowledge into the jQuery
library. jQuery will run exactly the same in all major browsers.
JQuery File
<head>
<script src="jquery-3.2.1.min.js"></script>
</head>
<script src="jquery-3.2.1.min.js"></script>
</head>
Eg:- <!DOCTYPE
html>
<html>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery("p").click(function(){
jQuery(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I
will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</body>
</html>
Eg:-<!DOCTYPE
html>
<html>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I
will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</body>
</html>
Eg:- <!DOCTYPE html>
<html>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This
is a heading</h2>
<p>This
is a paragraph.</p>
<p>This
is another paragraph.</p>
<button>Click
me</button>
</body>
</html>
0 comments
Post a Comment