Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

jQuery Basics

jQuery is most often used through its $ alias; in fact, you will see this symbol everywhere. The $ symbol is a shortcut for the jQuery() global function, and you will be writing it so much that you will be glad of the five characters it saves each time. But if you use the $ symbol in your own code or a third-party library, it could override the use of the symbol, causing your code not to work as expected. To make sure there are no conflicts when using the $, you can call jQuery.noConflict(), which will ensure that the jQuery function is the one being used.

The jQuery() Function

You can overload the jQuery() function (or $()) in four ways. It can be passed in a CSS selector; in a Document, Element, or Window object; in a string of HTML; or finally in a function. It also has a few utility functions that you will be learning about. Using CSS selectors is the most common, so you will be exploring them first.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial