Solved

Remove background colour of row with a checkbox contained in it

Posted on 2014-04-01
5
376 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now