Loop through radio buttons and change background color on the closet div, jquery

jmw132001

New Member
I've got a 6 x 8 grid essentially of radio buttons under the same name 'tselect'. When the page loads, I want all of them to run a command similar to this one\[code\]$(this).closest('div').addClass('highlight', 300);\[/code\]Basically change the background color of the closest div by adding a new div class on top. I tried doing a for loop to go through all of them, but the jquery command wasn't executing. Any ideas?Edit: Adding Code...\[code\]<div id="sch_cal"> <div id="sch_cal_column"> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">8:00am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">8:20am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">8:40am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">9:00am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">9:20am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">9:40am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">10:00am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> <div id="sch_cal_row"> <div id="sch_cal_time"><p class="ctime">10:20am</p></div> <div style="height: 100%"><input class="ctime" type="radio" name="tselect"/></div> </div> </div>\[/code\]
 
Top