IT. Expert System.

JQUERY

jQuery


Description

The jQuery object can be used to match a set of elements, create DOM elements on the fly, or bind a function to execute when the DOM has finished loading.

jQuery( selector [, context] )

Accepts a string containing a CSS selector which is then used to match a set of elements.


v1.0

This method has the form:

jQuery(selector [, context])
Parameter Description
selector (required) Specifies a string containing a selector expression
context (optional) Specifies a DOM Element, Document, or jQuery to use as context

Return Value

This form returns a jQuery object.


v1.0

This method has the alternate form:

jQuery(element)
Parameter Description
element (required) Specifies a DOM element to wrap in a jQuery object

Return Value

This form returns a jQuery object.


v1.0

This method has the alternate form:

jQuery(object)
Parameter Description
object (required) Specifies a plain object to wrap in a jQuery object

Return Value

This form returns a jQuery object.


v1.0

This method has the alternate form:

jQuery(elementArray)
Parameter Description
elementArray (required) Specifies an array containing a set of DOM elements to wrap in a jQuery object

Return Value

This form returns a jQuery object.


Cloning jQuery Objects:
When a jQuery object is passed to the $() function, a clone of the object is created. This new jQuery object references the same DOM elements as the initial one.

v1.0

This method has the form:

jQuery(jQuery object)
Parameter Description
jQuery object (required) Specifies an existing jQuery object to clone

Return Value

This form returns a jQuery object.


Returning an Empty Set:
Calling the jQuery() method with no arguments returns an empty jQuery set (with a .length property of 0).


v1.4

This method has the form:

jQuery()

Return Value

This form returns a jQuery object.

Examples

Example: Find all p elements that are children of a div element and apply a border to them:

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <p>one</p> <div><p>two</p></div> <p>three</p>
<script>
  $("div > p").css("border", "1px solid gray");
</script>

</body>
</html>

Example: Find all inputs of type radio within the first form in the document:

$("input:radio", document.forms[0]);

Example: Find all div elements within an XML document from an Ajax response:

$("div", xml.responseXML);

Example: Set the background color of the page to black:

$(document.body).css("background", "black");

Example: Hide all the input elements within a form:

$(myForm.elements).hide()


jQuery(html [, ownerDocument])

Creates DOM elements on the fly from the provided string of raw HTML.

v1.0

This method has the form:

jQuery(html [, ownerDocument])
Parameter Description
html (required) Specifies a string of HTML to create on the fly - note that this parses HTML, not XML
ownerDocument (optional) Specifies a document in which the new elements will be created

Return Value

This form returns a jQuery object.


v1.4

This method has the alternate form:

jQuery(html, props)
Parameter Description
html (required) Specifies a string defining a single, standalone, HTML element (e.g. <div/> or <div></div>
props (required) Specifies a map of attributes, events, and methods to call on the newly-created element

Return Value

This form returns a jQuery object.

Examples

Example: Create a div element (and all of its contents) dynamically and append it to the body element. Internally, an element is created and its innerHTML property set to the given markup:

$("<div><p>Hello</p></div>").appendTo("body")

Example: Create some DOM elements:

$("<div/>", {
  "class": "test",
  text: "Click me!",
  click: function(){
    $(this).toggleClass("test");
  }
}).appendTo("body");

jQuery(callback)

Binds a function to be executed when the DOM has finished loading.

v1.0

This method has the form:

jQuery(callback)
Parameter Description
callback (required) Specifies the function to execute when the DOM is ready

Return Value

This form returns a jQuery object.

Examples

Example: Execute the function when the DOM is ready to be used:

$(function(){
  // Document is ready
});


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 105 / 158850769. Delta: 0.00436 с