Add CSS style fontWeight to an element at runtime - Javascript CSS Style Property

Javascript examples for CSS Style Property:fontWeight

Description

Add CSS style fontWeight to an element at runtime

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <a id="myP" href="www.example.com">Example</a>
      <script type="text/javascript">
         console.log("myP");
        document.getElementById("myP").style.fontWeight = "bold";
    /* w w w . j  av a2s .c o  m*/
      </script>  
   </body>
</html>

Related Tutorials