Understanding jQuery Syntax

Introduction

jQuery syntax is quite simple. Below is how we perform some action using jQuery –

$(selector).action()

  • $ sign is used to access jQuery
  • selector is specified as #div or .class or #div .class or #div .class h1
  • action is the inbuilt jQuery functions like hide(), show(), etc.

All the jQuery methods must be present within its document-ready event block, to make sure that none of the jQuery code executes before the page has fully loaded.


Example Code

Receive our updates to your inbox

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.