Solved

Remove background colour of row with a checkbox contained in it

Posted on 2014-04-01
5
382 Views
Last Modified: 2014-04-02
Hi

This mess of code is generated by a Grid control:

<tr class="rgAltRow" style.backgroundColor="this.originalstyle=this.style.backgroundColor;this.style.backgroundColor=&#39;#FDC179&#39;" id="rpbOutcomes_i0_rgProcedures_ctl00__1" style="background-color:#FFD666;">
		<td class="rgGroupCol">&nbsp;</td><td style="display:none;">143</td><td style="display:none;">&nbsp;</td><td valign="top">Urodynamics (with catheter)</td><td align="center" valign="top">7B2B7</td><td align="center" valign="top">M47.4</td><td align="center">
                                                                        <span style="display: none"><input id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_chkLeft" type="checkbox" name="rpbOutcomes$i0$rgProcedures$ctl00$ctl07$chkLeft" /><label for="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_chkLeft">L</label></span>
                                                                        <span style="display: none"><input id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_chkRight" type="checkbox" name="rpbOutcomes$i0$rgProcedures$ctl00$ctl07$chkRight" /><label for="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_chkRight">R</label></span>&nbsp;
                                                                    </td><td align="center">
                                                                        <span id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_txtSite_wrapper" class="riSingle RadInput RadInput_Default" style="width:80px;"><input id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_txtSite" name="rpbOutcomes$i0$rgProcedures$ctl00$ctl07$txtSite" size="20" maxlength="50" class="riTextBox riEnabled" type="text" value="" /><input id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_txtSite_ClientState" name="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_txtSite_ClientState" type="hidden" /></span>&nbsp;
                                                                    </td><td align="center">
                                                                        <span class="primaryProc"><input id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_chkPrimary" type="checkbox" name="rpbOutcomes$i0$rgProcedures$ctl00$ctl07$chkPrimary" checked="checked" onclick="setPrimaryProcedure(this);" /></span>
                                                                    </td><td align="center">
                                                                       <input id="rpbOutcomes_i0_rgProcedures_ctl00_ctl07_chkSecondary" type="checkbox" name="rpbOutcomes$i0$rgProcedures$ctl00$ctl07$chkSecondary" onclick="setSecondaryProcedure(this);" />
                                                                    </td>
	</tr>

Open in new window



You will see I have a row - contained in this row is a Checked checkbox with the class ID of primaryProc.

What I want to do is remove the background colour of this row.

Here is what I have at the moment but it doesn't work:

 $(".primaryProc").style.backgroundColor = "#fff"

Open in new window

I have also tried removing the colour attribute and used "" instead.

Andy
0
Comment
Question by:Andy Green
[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
5 Comments
 
LVL 5

Assisted Solution

by:jayakrishnabh
jayakrishnabh earned 250 total points
ID: 39969170
$("#rpbOutcomes_i0_rgProcedures_ctl00__1").css('background-color', '');
0
 
LVL 3

Author Comment

by:Andy Green
ID: 39969279
Thanks but won't this only work for that one cell, I didn't say but any row in the grid could be set with a tick.

This can't be hard coded, its got to work for any row in the table.

However there will only ever be 1 row at a time with a checkbox with the primaryProc class.

Andy
0
 
LVL 3

Author Comment

by:Andy Green
ID: 39969668
Hi

I have this working after a fashion. By changing my code to this:

$(".primaryProc").parent().parent().css('background-color','#fff');

Is there a more elegant solution than .Parent().Parent().

Thank you jayakrishnabh for the correct syntax for applying the style.

Andy
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 250 total points
ID: 39971806
Have a go with this:

$(".primaryProc").parents('tr').css('background-color','#fff');

Open in new window

0
 
LVL 3

Author Closing Comment

by:Andy Green
ID: 39971820
Thanks Guys. I have halved the points. Hope that's OK with you both.

Andy
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

623 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