jQuery Basics
Structure Of A jQuery Script
Typically, your scripts will follow the pattern shown in the following code snippet.
<!DOCTYPE html> /*from w w w. j a v a 2s. 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()
.