Step-by-step learning jquery (a) jquery object

Source: Internet
Author: User
Tags jquery library

JQuery is another excellent JavaScript library following Prototype.
JQuery Concept: write less, do more. The advantages are as follows:
Lightweight
Powerful Selector
Excellent DOM operation encapsulation
Reliable event-handling mechanism
The Perfect Ajax
Excellent browser compatibility

Chain-operated mode

Jquery:hello World

1. JQuery Object

jquery objects are objects that are produced after wrapping a DOM object through jquery ($ ())
jquery objects are unique to jquery. If an object is a jquery object, then it can use the method in jquery: $ ("#persontab"). html ();
jquery objects cannot use any method of the DOM object, nor can the DOM object use any of the methods in jquery
Convention: If you get a JQuery object, precede the variable with $.
var $variable = JQuery Object
var variable = DOM Object

1.1jQuery objects Turn into DOM objects

jquery objects cannot use methods in the DOM, but if jquery does not encapsulate the desired method, it has to use the DOM object, as in the next two ways:

(1) The JQuery object is an array object that can be obtained by means of [index].

(2) Use the Get (index) method in JQuery to get the corresponding DOM object

<! DOCTYPE html>

1.2 DOM objects into JQuery objects

For a DOM object, you can get a jquery object by wrapping the DOM object with $ () (the jquery object is the object that was created after wrapping the DOM object with jquery). After conversion, you can use the methods in JQuery.




To learn jquery (a) jquery object step by step

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.