Link to home
Start Free TrialLog in
Avatar of Andy Green
Andy GreenFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Remove background colour of row with a checkbox contained in it

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
SOLUTION
Avatar of jayakrishnabh
jayakrishnabh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andy Green

ASKER

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
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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Guys. I have halved the points. Hope that's OK with you both.

Andy