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(;
for (var r=0; radgroup[r]; ++r) 
radgroup[r] = radgroup[r].checked ? 'black' : 'red';

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

All 2 Replies


Use font-weight:

radgroup[r] = 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 meeting, learning, and sharing knowledge.