Solved

Remove background colour of row with a checkbox contained in it

Posted on 2014-04-01
5
372 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 42

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

by Julian Matz As of jQuery (http://jquery.com/) 1.4 the .live() method (http://api.jquery.com/live/) supports custom events as well as some standard JavaScript events that it previously didn't support. Among these is the submit event. Unlike …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…

747 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

10 Experts available now in Live!

Get 1:1 Help Now