jquery element Positioning method

Source: Internet
Author: User

Open the page in Chrome browser, press F12 to bring up the developer debug mode, view elements, part of the code as shown, note the Red box section

Suppose we want to find the position of some element, and move it with the mouse over that part, the debugger automatically signs the corresponding code in the selected section with a blue color, as shown in the red box.

Click Console

In console input command: elements=jquery.find (' Button.navbar-toggle ')

The goal is to find the corresponding element of jquery and assign the object property to the elements variable

After running, you can see all the corresponding elements, and then enter Elements[0] Such statements exactly locate the element you want to see, 0 is the first, 1 is the second

Finally enter a command such as Elements[0].textcontext to view the label properties, assuming that the view element resembles <...class= ' Navbar-toggle ' ...>image<...> such a format, Then the Elements[0].textcontext command executes the result as an image

Use this method to quickly crawl jquery elements in a Web page

jquery element Positioning method

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.