- Jan 2, 2006
- 10,455
- 35
- 91
I have a list of things in a web form. Each item on the list has a checkbox next to it. Some of the checkboxes have checkmarks already in them, and others are empty.
I want the text next to the checkbox to turn bold whenever there is a check in the box.
So the text that already has a checkmark in the box next to them by default should appear bold on load.
Item text that has an empty checkbox next to them should turn bold the moment I place a checkmark in it.
How do I do this?
In the CSS, I have:
I want the text next to the checkbox to turn bold whenever there is a check in the box.
So the text that already has a checkmark in the box next to them by default should appear bold on load.
Item text that has an empty checkbox next to them should turn bold the moment I place a checkmark in it.
How do I do this?
Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
<script>
$('#check1').click(function(){
$('#lab1').toggleClass('check-bold')
})
$('#check2').click(function(){
$('#lab2').toggleClass('check-bold')
})
$('#check3').click(function(){
$('#lab3').toggleClass('check-bold')
})
</script>
<input id="check1" type="checkbox" name="hdrphotos" value="Unlimited HDR Photography" checked/>
<label id="lab1">Unlimited HDR Photos<br>
</label>
<input id="check2" type="checkbox" name="panoramas" value="Panoramas" checked/>
<label id="lab2">Panoramas<br>
</label>
<input id="check3" type="checkbox" name="video" value="Video" checked/>
<label id="lab3">Video<br>
</label>
In the CSS, I have:
Code:
.check-bold{
font-weight: bold;
}
