Jquery is a cross-platform Javascript library and its purpose is to make the web development easier. We can reduce the multiple lines of code of Javascript by using the single block statements of jquery.
Advantages of jquery:
- It introduces a number of useful plugins.
- Jquery has powerful chaining capabilities
- It is used to develop the AJAX Components.
- Cross-Browser compatibility.
- It is used to make the code simple and reusable.
Syntax of jquery:
$(Selector).action()
Selector selects the html components and action performed on selected components.
Jquery Selectors:
Here is the list of jquery selectors:
Selector | Description |
---|---|
$(“*”) | It is used to select all the HTML components. |
$(“p.demo”) | It is used to select p tag elements by using the class name of the p tag. |
$(“:button”) | It is used to select the button and input elements. |
$(“tr:even”) | It is used to select the even <tr> tag elements. |
$(“tr:odd”) | It is used to select the odd <tr> tag elements. |
$(“span:parent”) | It is used to select the elements which have a child element associated. |
$(“[href]”) | It is used to select all elements with href attributes. |
$(“:input”) | It is used to select all form elements. |
Jquery Event methods : Event methods trigger a function to an event handler for the selected elements.
Here is the list for mouse event methods :
Mouse event methods | Description |
.mouseenter() | This method is used to triggers mouseenter event. |
.dbclick() | This method is used to trigger the dblclick event. |
.click() | This method is used to trigger the dblclick event. |
.mouseleave() | This method is used to trigger the mouseleave event. |
.mousedown() | This method is used to trigger the mousedown event. |
.mouseup() | This method is used to trigger the mouseup event. |
Here is the list of Keyboard event methods:
Keyboard event methods | Description |
.keypress() | This method is used to bind an event handler to the “keypress” JavaScript event or trigger that event on an element. |
.keydown() | This method is used to bind an event handler to the “keydown” JavaScript event or trigger that event on an element. |
.keyup() | This method is used to bind an event handler to the “keyup” JavaScript event or trigger that event on an element. |
Jquery Effects:
Jquery effects | Description |
---|---|
hide() | This method is used to hide the selected elements. |
show() | This method is used to show the selected elements. |
toggle() | This method is used to toggle the selected elements. |
animate() | This method is used to prepare custom animations. |
delay() | This method is used to allow the delayed execution of the selected elements. |
dequeue() | This method is used to execute the next sequence of functions present in the queue. |
stop() | This method is used to stop the animation or effects before it is finished. |
fadeTo() | This method is used to fades an element to given opacity. |
fadeIn() | This method is used to fades a hidden element. |
fadeOut() | This method is used to allow a visible element to be faded. |
fadeToggle() | This method allows the element to get toggled using fadeIn and fadeOut methods. |