Lesson 1: Syntax

Lesson 1

jQuery Syntax

jQuery adds exciting events to websites

jQuery syntax selects certain HTML elements and assigns an action to those HTML elements.

$(selector).action()

Start the jQuery phrase with a $ symbol to tell the browser to access the jQuery library. Specify the HTML element in the (selector) portion. Then, choose a jQuery .action() to be associated with the HTML element.

For example, the following code will employ jQuery and hide all H1 elements in your HTML document.

$("h1").hide()

It’s that easy, and fun. There are many other things you can do with the HTML elements other than hiding them. We will explore some practical uses of jQuery events in another lesson.

Before we can move further, let’s get more comfortable with selectors and events.


 

Back to Intro to jQuery

Forward to Lesson 2: Selectors

One thought on “Lesson 1: Syntax

Leave a comment