The simple knowledge of jquery

Source: Internet
Author: User

Just touching jquery this week, indeed, doing the most things with the least amount of code, we just write a few lines of code to achieve amazing results. There is no need to worry too much about browser differences, even in IE this is a more special and disgusting browser can be very good compatibility, do not worry about your DOM operation will not be supported under IE problems.

It can not only manipulate the DOM, but also can implement animation, events and other processing. It is also a chained operation, that is, a set of actions on the same jquery object that can be ligatures directly without having to retrieve the object repeatedly. This can save a lot of code for us. And it's open-source, and anyone can use it freely.

such as: document.getElementById ("mydiv"). Value;

The implementation in jquery is $ ("#myDiv"). Val (); Simple, rough, easy to use!

However, if you need to convert between the DOM and jquery operations, you need to convert between the two, as follows:

var $CR = $ ("#cr")--var cr = $CR [0]; Or: var cr = $CR. get[0] This is the transition from jquery to DOM operation.

var Cr=document.getelementbyid ("Cr")---Var $cr =$ (CR); This is the transition from DOM to jquery.

The selection of common HTML elements

$ ("xxx")--all <xxx> tagged elements $ ("P#demo")--All Id= "demo" <p> Elements $ ("P.style")--all class= " Style "<p> element $ (" #demo ")--All Id=" demo "Elements $ (". Style ")--all class=" style "elements

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.