Why Study jQuery ?

jQuery Get Started

jQuery Syntax

Examples:

$(this).hide() - hides the current element.
$("p").hide() - hides all <p> elements.
$(".test").hide() - hides all elements with class="test".
$("#demo").hide() - hides the element with id="demo".

The Document Ready Event

All jQuery methods in our examples, are inside a document ready event:


This is to prevent any jQuery code from running before the document is finished loading (is ready).

jQuery Selectors

The element Selector

			In this code, the $ symbol is used to create a jQuery object. 
			The document.ready() method is used to ensure that 
			the jQuery code is executed only after the document is fully loaded.
		

The #id Selector

The .class Selector

More Examples of jQuery Selectors

https://www.w3schools.com/jquery/jquery_ref_selectors.asp

jQuery Event Methods

What are Events?

jQuery Syntax For Event Methods

Commonly Used jQuery Event Methods

click()

dblclick()

mouseenter()

mouseleave()

hover()

focus()

blur()

			In JavaScript:
			
			$(document).ready(function(){
  				$("input").focus(function(){
    				$(this).css("background-color", "yellow");
  				});
  				$("input").blur(function(){
    				$(this).css("background-color", "green");
  				});
			});

			In HTML:

			 Name: <input type="text" name="fullname"><br>
			Email: <input type="text" name="email">
		

The on() Method

The Document Object Model

The Document Nodes

In the HTML DOM (Document Object Model), everything is a node:

The Document Object

$(document).ready()

We’ll start our jQuery magic using the $(document).ready():

The functional approach