"JQuery: Traverse all values of the same class and traverse the value of a column TD"

Source: Internet
Author: User

JSP Code:

HTML code

    1. <c:foreach var= "main" items= "${mainpage.list}" >
  • <tr>
  • <td><a class= "SCENESTR_TD" >${main.scenestr}</a></td>
  • <TD class= "concern" >${main.concernednumber}</td>
  • <TD class= "Noconcern" >${main.noconcernednumber}</td>
  • <TD class= "ValidateNumber" >${main.validatenumber}</td>
  • <td>${main.createtime}</td>
  • <td>${main.delflag==0? ' Allow ': ' Do not allow '}</td>
  • <td>
  • <a href= "${main.url}" target= "_blank" > QR code link </a>
  • </td>
  • </tr>
  • </c:forEach>
  • <tr class= "Count_main" >
  • <th style= "Text-align:center;" > Statistics:</th>
  • <TD class= "Count_concern" >0</td>
  • <TD class= "Count_noconcern" >0</td>
  • <TD class= "Count_validatenumber" >0</td>
  • <td></td>
  • <td></td>
  • <td></td>
  • </tr>

Copy Code

JS Code:

HTML code

    1. var main_list_size = $ (". Main_list_size"). Val ();//Get primary single loop size
  • Main_list_size = parseint (main_list_size);
  • var count_concern = parseint (0);
  • var count_noconcern = parseint (0);
  • var count_validatenumber = parseint (0);
  • if (main_list_size<=0) {
  • $ (". Count_main"). Hide ();//When there is no data, the row is hidden
  • }else{
  • var concern = $ (". Concern Noconcern ValidateNumber");
  • for (Var i=0;i<main_list_size;i++) {
  • Count_concerncount_concern = count_concern+ parseint ($ (". Concern"). EQ (i). html ());
  • Count_noconcerncount_noconcern = Count_noconcern + parseint ($ (". Noconcern"). EQ (i). html ());
  • Count_validatenumbercount_validatenumber = Count_validatenumber + parseint ($ (". ValidateNumber"). EQ (i). html ());
  • }
  • $ (". Count_concern"). HTML (Count_concern);
  • $ (". Count_noconcern"). HTML (Count_noconcern);
  • $ (". Count_validatenumber"). HTML (count_validatenumber);
  • $ (". Count_main"). Show ();//When there is data, the line is displayed
  • }

Copy Code

So, the following statistics are all out?


Original Address Java Community http://techfoxbbs.com/thread-2646-1-1.html

"JQuery: Traverse all values of the same class and traverse the value of a column TD"

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.