Set the colour of a text in a textarea using html input tag - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea


Demo Code

ResultView the demo in separate window

      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <form name="myform">
         Select Color : 
         <input type="color" onchange="Color(this)"> 
      <textarea name="myTextArea" id="myTextArea" cols="100" rows="14" placeholder="Enter Text Here ...">Test text..</textarea> 
      <script type="text/javascript">
function Color(obj) {/*w  ww. j a v  a2 s  .c om*/
    document.getElementById("myTextArea").style.color = obj.value;


Related Tutorials