Get the div id attribute for fuzzy matching

Source: Internet
Author: User

There is a batch of IDs in the HTML, ending with numbers + fixed characters, and the foreground needs to pass this batch of IDs into the background

Suppose that the fixed trailing character is "pic", using var pidlist=$ ("[id$= ' pic ']"), and all the matching HTML is removed

Then remove the ID:

for (Var i=0;i<pidlist.length;i++) {
Alert (pidlist[i].id.substring (0,pidlist[i].id.length-3));
}

3 is to remove the existing "pic", get the number, and then save the method to the array to pass to the background

Note, you can also set the Class property for the HTML in which these IDs reside, and then get all the IDs uniformly, this method should be better

Get the div id attribute for fuzzy matching

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.