where
selector
define the Query or select a specific element from HTML document.action()
define the action() to be performed on selected elements of HTML document.<p>
elements.
In this below example : $
sign defines the jQuery library, p
element is the selector and it will select all p
elements of HTML document, hide()
function is action to hide all current visible p
elements of HTML document.
<html> <head> <title>jQuery Syntax</title> </head> <body> <h1>Welcome to SPLessons</h1> <p>This is a first paragraph</p> <span>This is a span element</span> </body> </html>
$(document).ready(function() { $("p").hide(); });
Output:
Fade in/Fade out : This involves of hiding and showing html elements using nice fading effects. It is well used to show or hide a div and its content in a proper way.