I'm pretty new with coding, so bear with me. I've got a button on a page that, if I press on it, should make the specific text bold.
But for some reason it doesn't work and I have no clue why..
Here is an example:
HTML
<input type="button" class="btn" onclick="boldtext();" />
<br />
<div id="text">This is some text</div>
Javascript
function boldtext () {
document.getElementById('text').style.fontWeight = 'bold';
}
My problem is when I click on the button, nothing happens.
Did I make a mistake somewhere?