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

enter image description here


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

xml - How do I use an xdoxslt variable inside xsl code, in BI Publisher? -