Setting a text to Bold in a textarea - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

Setting a text to Bold in a textarea

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <form name="myform"> 
         <input type="button" onclick="Bold()" value="Bold"> 
      </form> 
      <textarea name="myTextArea" id="myTextArea" cols="100" rows="14" placeholder="Enter Text Here ..."></textarea> 
      <script type="text/javascript">
function Bold() {/* ww  w .ja  v a 2  s .  co  m*/
    document.getElementById("myTextArea").style.fontWeight = 'bold';
}

      </script>  
   </body>
</html>

Related Tutorials