I am new to jquery and i am having problem i want to change background color of parent div when i click at checkbox
Please Advice
Thank You
<script type="text/javascript">
function chngbg(id){
id2 = "d-" + id;
$(id2).addClass('bg');
}
</script>
<div class="dataDiv" id="d-<?=$row->id?>">
<input type="checkbox" onchange="chngbg($(this).val());" value="<?=$row->id?>" name="cbox" /></span>
</div>
You are missing the
#in your id selector.By the way, you’ve got an extra
</span>that seems like it doesn’t belong.