JQuery selector usage example _ jquery-js tutorial

Source: Internet
Author: User
This article mainly introduces the usage of the jQuery selector. It analyzes the usage tips and precautions of the jQuery selector based on examples. For more information, see the examples in this article. We will share this with you for your reference. The details are as follows:

JQuery uses two methods to select the html element. The first method is to combine CSS and the Xpath selector to form a string and transmit it to the jQuery Constructor (for example: $ ("p> ul a"); the second is to use several methods of the jQuery object ). These two methods can also be combined for hybrid use.

There are many methods to select CSS and XPath selectors. For details about CSS selectors, refer to related articles on this site.

First, let's take a look at getting an element through the element ID: $ ("# id"). Adding # In front of the name indicates that this is an id. Do not discard the quotation marks.

Add a span element with the id of msg to the page and display helloworld In the span element, which can be implemented as follows:

  Hello  
Related Article

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.