how can i change the color and the font type to bold when the checkbox is oncheck?

<script type="text/javascript" language="javascript">
function colorBlack(e2) {
var radgroup = document.getElementsByName(e2.name);
for (var r=0; radgroup[r]; ++r) 
radgroup[r].parentNode.style.color = radgroup[r].checked ? 'black' : 'red';
}
 </script>

this is the code to change the color but i dunno how to change the text to bold..
can u all help me please? thank you

Recommended Answers

document.getElementById('some_id').style.fontFamily='courier';
document.getElementById('some_id').style.fontFamily='verdana';

Jump to Post

All 2 Replies

document.getElementById('some_id').style.fontFamily='courier';
document.getElementById('some_id').style.fontFamily='verdana';

Use font-weight:

radgroup[r].parentNode.style.fontWeigth = radgroup[r].checked ? 'bold' : 'normal';
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.