javascript - Button to make text in the div bolded -
i'm pretty new coding, bear me. i've got button on page that, if press on it, should make specific text bold.
but reason doesn't work , have no clue why..
here example:
html
<input type="button" class="btn" onclick="boldtext();" /> <br /> <div id="text">this text</div> javascript
function boldtext () { document.getelementbyid('text').style.fontweight = 'bold'; } my problem when click on button, nothing happens.
did make mistake somewhere?
write javascript code in <head> tag. code working. see demo

Comments
Post a Comment