Marvel at jquery (solving the conversion from jquery objects to Dom)

Source: Internet
Author: User

Jquery is a javascript framework, but it is definitely not some packaging in the general sense. I personally feel that it is a framework that changes the JS control mode. We can use jquery to separate pages and effects, just as art did by writing CSS to separate page code ,. The following is an introduction:

Jquery has the following features: 1. concise code, easy-to-understand semantics, fast learning, and rich documentation. 2. jquery is a lightweight script with very small code. The latest JavaScript package is only about 20 kb. 3. jquery supports CSS1-CSS3 and basic XPath. 4. jquery supports cross-browser browsers, including IE 6.0 +, FF 1.5 +, Safari 2.0 +, and opera 9.0 +. 5. Other functions can be easily extended for jquery. 6. JavaScript code and HTML code can be completely separated to facilitate code maintenance and modification. 7. rich plug-ins. In addition to some special effects of jquery, you can use plug-ins to implement more functions, such as form verification, Tab navigation, drag-and-drop effects, table sorting, and DataGrid, tree menu, image effects, and Ajax upload. Jquery design will change the way you write JavaScript code, reduce the complexity of learning to use JavaScript to operate webpages, and improve the JS development efficiency of webpages, no matter for beginners of JS or senior experts, jquery will be your first choice. Jquery is suitable for designers, developers, and other good people. It is also suitable for commercial development. It can be said that jquery is suitable for any JavaScript Application and can be used in different web applications. Official site: http://jquery.com/Chinese site: http://jquery.org.cn/after using jquery, also found some unpleasant places: 1. A large number of use of callback (similar to Java using anonymous internal class) format. The code is not easy to read, and even more troublesome is that the Code will be lost if you are not careful.}) The end character causes JS failure .. Debugging JS is a painful process. 2. All the objects obtained using $ {} Are jquery objects, causing Dom functions and event invalidation. For example, for <input type = "checkbox" id = "AAA"/>, use $ ("# AAA") to obtain the jquery object, but $ ("# AAA "). checked may cause errors. jquery uses its own API, which is incompatible with standard Js. p.s. solve the conversion from jquery to DOM objects: <input type = "checkbox" id = "AAA"/> 1. use $ ("# AAA") to obtain the jquery object. You can use $ ("# AAA") [0] to obtain the DOM object. $ ("# AAA") [0]. Checked is correct. 2. A get () function is mentioned in the jquery API, which can be used to convert objects to Dom. Get () gets all the matching Dom element sets. This is a backward compatible method for obtaining all matching elements (different from jquery objects, but actually element arrays ). This function is very useful if you want to directly operate DOM objects instead of jquery objects. ------------------------------------------------------------------------------ Access all matched DOM elements. this serves as a backwards-compatible way of accessing all matched elements (other than the jquery object itself, which is, in fact, an array of elements ). it is useful if you need to operate on the DOM elements themselves instead of using built-in jquery functions. returned value array <element>

Note that the returned message is a queue. $ ("# AAA"). Get () [0] can return the input element of the current Dom. $ ("# AAA"). Get () [0]. The checked usage is correct.

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.