Jquery solves the problem of getting peer Elements

Source: Internet
Author: User


Technical Summary:

Problem description: using the Repeater control to obtain records from the database, how can we obtain the records of the same generation adjacent to the previous element set or the previous Element Set (the same record )?

Code Description:

<Asp: repeater id = "repquerytomodify" runat = "server">


<TD class = "mystuno">

<% # Eval ("stuno") %>



<% # Eval ("Grade") %>


<TD class = "modifylevelsocore">

<% # Eval ("score") %>



</ASP: repeater>

You can capture the "class = modifylevelsocore" information and how to obtain the information of class = "mystuno" (in the same record)

Solution: Use the jquery language:

VaR stuno = $. Trim (objtd. siblings (". mystuno"). Text ());

VaR levelname = $. Trim (objtd. Prev (). Text ());

In this way, we can obtain the different field values in the same record we want. This technology alone solves our own problems and hopes to help our viewers solve the problems. We can also talk a lot about it, make progress together.


I spent half a day searching for this issue on the internet yesterday. My personal opinion on finding something on the internet is that sometimes I feel that the main solutions to these problems are hidden on the Internet, I saw the same problem on the Internet, but it was depressing that so many people did not have a correct solution.

Later, I decided to start from the basics. I found the jquery manual and matched the document according to my needs. Finally, I found the solution, in fact, we can just filter out the question, so when I find the answer to the question, it seems that the technology is so simple, but when I am troubled by this question, when I tried to find the answer, it was really a pain ·····

From this point of view, I learned that I should first consider these solutions based on my own materials. If I have tried all the methods that I can think of, I 'd like to find them online, if this really involves technical issues, sometimes it may be because the technology that you are searching for is not home.

Therefore, we should also have our own wings to improve our ability to solve problems and optimize ourselves .............

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.