How to change color of one element by clicking on another - jquery -
i've got multiple choice test on english/thai language web site. each row has question , 4 answer choices, layout 50x5 matrix.
<div id="question"> <p class="word_test">1<span class="1 color_up audio" id="b1e01">the </span></p> ... <p class="word_test">50<span class="50 color_up audio" id="b1e50">if </span></p> </div> <div id="answers"> <div id="col_a"> <p class="word_test">a:<span class="1 color_up audio" id="b1t01">คำนำหน้านาม</span></p> ... <p class="word_test">a:<span class="50 color_up incorrect">มัน </span></p> </div> <div id="col_b"> ... </div> <div id="col_c"> ... </div> <div id="col_d"> <p class="word_test">d:<span class="1 color_up incorrect">เลอะ </span></p> ... <p class="word_test">d:<span class="50 color_up incorrect">เป็น อยู่ คือ </span> </p> </div> </div>
when user clicks on 1 of a,b,c or d choices, want question item in row change green (correct) or red (incorrect). problem how in 1 row link clicked target (a,b,c or d) requicolor change. can see addclass , removeclass handle color change can't see how make connection between clicked on answer , question items. i've numbered rows in each column corresponding question can referenced don't know if necessay. help.
see .click()
$("#other").click(function() { $("#target").css("background", "red"); });
Comments
Post a Comment