jQuery - SPLessons

Chapter 4

jQuery Syntax

jQuery Syntax

jQuery Syntax is to select specific elements from HTML document and perform some action on selected elements with manipulation in Dot sign ..



  • $ sign is used to define/access a jQuery library. jQuery library is actually declared in a variable called jQuery.
  • 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.

jQuery Basic Syntax Examples

$(“p”).hide() : hide() function of jQuery hides all current <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.

	   <title>jQuery Syntax</title>
		<h1>Welcome to SPLessons</h1>
		<p>This is a first paragraph</p>
		<span>This is a span element</span>



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.


  • jQuery Syntax selects HTML elements and perform action on selected elements.
  • $ accesses jQuery,selector selects HTML elements and action is a function performing some action on specified element.