Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Remove background colour of row with a checkbox contained in it

Posted on 2014-04-01
5
Medium Priority
?
387 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 1000 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 44

Accepted Solution

by:
Chris Stanyon earned 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

916 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