Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to find a row then highlight the row that is after the found row

Posted on 2013-12-19
3
Medium Priority
?
375 Views
Last Modified: 2013-12-19
Hi,
I need to find "Grand Total" in the below HTML and then change the background-color of the 3rd row or the row that has a cell with the class="apexir_AGGREGATE_VALUE"

I have tried:
$('span.apex_break_headers:contains("Grand Total")') and added .parent() or .closet('tr')
but doesn't work.

<tr><th colspan="3" class="apexir_REPEAT_HEADING" id="BREAK_ORGANIZATION_5">Organization : <span class="apex_break_headers"><!--1-->Grand Total</span>
    </th>
</tr>
<tr><th id="CUSTOMER"><div style="text-align:center;">Customer</div></th>
    <th id="REVENUE"><div style="text-align:center;">Revenue</div></th>
</tr>
<tr class="odd">
  <td  align="left" headers="CUSTOMER BREAK_ORGANIZATION_5">Total
  </td>
  <td  align="right" headers="REVENUE BREAK_ORGANIZATION_5">
    <a href="f?p=888:48:8976543071158::NO:48:P48_PA_PERIOD_NAME,P48_P_PERIOD_NAME,P48_P_ORG_ID,P48_PREV_GL_PERIOD_NAME,P48_CUSTOMER,P48_ORGANIZATION,P48_COLUMN:13-Oct-WK4,OCT-13,81,DEC-12,Total,,REVENUE" >$431,060.34</a>
  </td>
</tr>
<tr >
  <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="CUSTOMER BREAK_ORGANIZATION_5">
  </td>
  <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="right" headers="REVENUE BREAK_ORGANIZATION_5">$431,084,060.34<br />
  </td>
</tr>

Open in new window



others have same structure for subtotals so I need to zero in on the Grand Total span.

<tr><th colspan="3" class="apexir_REPEAT_HEADING" id="BREAK_ORGANIZATION_1">Organization : <span class="apex_break_headers"><!--0-->This Company</span></th></tr>

Open in new window

0
Comment
Question by:bcarlis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 1000 total points
ID: 39730691
Hi,
something like this?
http://jsfiddle.net/EE_RainerJ/QQ2Q7/

$('span.apex_break_headers:contains("Grand Total")').parents('tr').next().next().next().css( "background-color","red");

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 39730695
I don't follow you : http://jsfiddle.net/mFZ3Z/1/
var $Grand_Total_row = $('span.apex_break_headers:contains("Grand Total")').closest("tr");
$Grand_Total_row.css("backgroundColor", "yellow");

Open in new window

0
 
LVL 2

Author Comment

by:bcarlis
ID: 39730747
Awesome! The first one got the row, and I just needed to add .children (which Tony Miller had in the original code)

$('span.apex_break_headers:contains("Grand Total")').parents('tr').next().next().next().children().css( "background-color","red");

Open in new window

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question