HTML5 – jQuery
jQuery is a fast, small, and feature-rich JavaScript library that makes it easy to traverse HTML documents, handle events, and perform various other tasks. Here is an overview of some of the key features of jQuery:
- DOM manipulation: jQuery provides a range of methods for manipulating the Document Object Model (DOM) such as
addClass
,removeClass
,hide
,show
,append
, andprepend
. - Event handling: jQuery provides a range of methods for handling events such as
click
,mouseenter
,mouseleave
,submit
, andresize
. - Ajax: jQuery provides a range of methods for performing asynchronous HTTP requests such as
$.get
,$.post
, and$.ajax
. - Effects: jQuery provides a range of methods for creating animations and effects such as
fadeIn
,fadeOut
,slideUp
, andslideDown
.
Here is an example of how to use jQuery to add a class to an element when it is clicked:
$('#element').click(function() {
$(this).addClass('active');
});
In this example, the click
method is used to bind a click event handler to the element with the id
of element
. When the element is clicked, the addClass
method is used to add the active
class to the element.