<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="jQuery 1.2 API Reference,Visual jQuery 1.2,jQuery doc,KISS,keep it simple & stupid!,Priscilla Chan,wstudio,jQuery,Java,Python,Wordpress,Ubuntu,Django,web.py" />
<meta name="description" content="jQuery 1.2 API Reference,like visual jQuery 1.2" />
<link rel="shortcut icon" href="style/img/favicon.ico" />
<title>jQuery 1.2 API Reference</title>
<link rel="stylesheet" type="text/css" href="style/jqueryapi.css" />
<script type="text/javascript" src="style/lib/jquery.js"></script>
<script type="text/javascript" src="style/lib/jquery.corner-min.js"></script>
<script type="text/javascript" src="style/jqueryapi.js"></script>
</head>
<body>
<div id="topnav">
<a class="topnav" href="http://wstudio.web.fc2.com/index.html" title="返回 KISS 首页">KISS</a>
<span class="topnav">|</span>
<a class="topnav" href="http://wstudio.web.fc2.com/wstudio/index.html" title="返回 W 工作室">W 工作室</a>
</div>
<div id="header"></div>
<hr color="#595959" />
<div id="foldandexpand">
<button id="fold">Fold</button>
<button id="expand">Expand</button>
<button id="foldall">Fold All</button>
<button id="expandall">Expand All</button>
</div>
<div class="mainmenu">
<!-- Core -->
<div class="menuitem">Core</div>
<div class="functionmenu">
<div class="categoryitem">The jQuery Function</div>
<div class="category">
<div class="functionitem">jQuery(expr,context)</div>
<div class="content">
<h1>jQuery(expression,[context])</h1>
<div class="desc">
<div>This function accepts a string containing a CSS or basic XPath selector which is then used to match a set of elements.
</div>
<div class="longdesc">The core functionality of jQuery centers around this function. Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS or XPath), which then finds all matching elements. <p>By default, if no context is specified, $() looks for DOM elements within the context of the current HTML document. If you do specify a context, such as a DOM element or jQuery object, the expression will be matched against the contents of that context.
</div>
</div>
<h2>Returns</h2>
<p class="indent">jQuery</p>
<h2>Arguments</h2>
<p class="indent"><strong>expression </strong>(String) : An expression to search with.</p>
<p class="indent"><strong>context </strong>(Element, jQuery) : (Optional) A DOM Element,Document or jQuery to use as context.</p>
<h2>Examples</h2>
<p class="indent">
Finds all p elements that are children of a div element.
</p>
<p class="indent"><strong>Source code:</strong></p>
<div class="code">
<p>one</p> <div><p>two</p></div> <p>three</p>
</div>
<p class="indent"><strong>jQuery code:</strong></p>
<div class="code">
$("div > p");
</div>
<p class="indent"><strong>Result:</strong></p>
<div class="code">
[ <p>two</p> ]
</div>
<hr/>
<p class="indent">
Finds all inputs of type radio within the first form in the document.
</p>
<p class="indent"><strong>jQuery code:</strong></p>
<div class="code">
$("input:radio", document.forms[0]);
</div>
<hr/>
<p class="indent">
Finds all div elements within an XML document from an AJAX response.
</p>
<p class="indent"><strong>jQuery code:</strong></p>
<div class="code">
$("div", xml.responseXML);
</div>
</div>
<div class="functionitem">jQuery(html)</div>
<div class="content">
<h1>jQuery(html)</h1>
<div class="desc">
<div>Create DOM elements on-the-fly from the provided String of raw HTML.
</div>
<div class="longdesc">You can pass in plain HTML Strings written by hand, create them using some template engine or plugin, or load them via AJAX. There are limitations when creating input elements, see the second example. Also when passing strings that may include slashes (such as an image path), escape the slashes.
</div>
</div>
<h2>Returns</h2>
<p class="indent">jQuery</p>
<h2>Arguments</h2>
<p class="indent"><strong>html </strong>(tring) : A string of HTML to create on the fly.</p>
<h2>Examples</h2>
<p class="indent">
Creates a div element (and all of its contents) dynamically, and appends it to the body element. Internally, an element is created and its innerHTML property set to the given markup. It is therefore both quite flexible and limited.
</p>
<p class="indent"><strong>jQuery code:</strong></p>
<div class="code">
$("<div><p>Hello</p></div>").appendTo("body")
</div>
<hr/>
<p class="indent">
Do not create <input>-Elements without a type-attribute, due to Microsofts read/write-once-rule for the type-attribute of <input>-elements</p>
<p class="indent"><strong>jQuery code:</strong></p>
<div class="code">
// Does NOT work in IE:<br>
$("<input>").attr("type", "checkbox");<br>
// Does work in IE:<br>
$("<input type='checkbox'>");<br>
</div>
</div>
<div class="functionitem">jQuery(elements)</div>
<div class="content">
<h1>jQuery(elements)</h1>
<div class="desc"><div>Wrap jQuery functionality around a single or multiple DOM Element(s).</div> <div class="longdesc">This function also accepts XML Documents and Window objects as valid arguments (even though they are not DOM Elements).</div></div>
<h2>Returns</h2>
<p class="indent">jQuery</p>
<h2>Arguments:</h2>
<p class="indent"><strong>elements </strong>(Element, Array<Element>) : DOM element(s) to be encapsulated by a jQuery object.</p>
<h2>Examples</h2>
<p class="indent">
Sets the background color of the page to black.
</p>
<p class="indent"><strong>jQuery code:</strong></p>
<div class="code">
$(document.body).css( "background", "black" );
</div>
</div>
<div class="functionitem">jQuery(callback)</div>
<div class="content">
<h1>jQuery(callback)</h1>
<div class="desc"><div>A shorthand for $(document).ready().</div> <div class="longdesc">Allows you to bind a function to be executed when the DOM document has finished loading. This function behaves just like $(document).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready to be operate