jQuery Basics

In this chapter you will learn:

  1. Structure Of A jQuery Script
  2. jQuery core function

Structure Of A jQuery Script

Typically, your scripts will follow the pattern shown in the following code snippet.

<!DOCTYPE html> //from   ja v  a 2  s. c  o  m
<html>
<head> 
    <script src="http://yourServer.com/jQuery/jquery.min.js"></script> 
    <script> 
        jquery code here
    </script> 
</head> 
<body> 
  <p>Your tags here</p>
</body> 
</html>

jQuery core function

The jQuery core function(factory object) is referenced as either.

jQuery()

or

$()

$() is a "function".

It can accept:

  • a selector string
  • a string of raw HTML
  • a DOM element
  • an existing jQuery object

$() returns a jQuery object. The jQuery object has several methods, for example, $.ajax() or $.each().

Next chapter...

What you will learn in the next chapter:

  1. Pattern of using jQuery
Home » jQuery » Introduction
jQuery Basics
jQuery practice