Monday 5 March 2012

How to insert tab in JavaScript?

Definition: "\t" will insert tab in the text.

Example:
 
Script Part:
 
   function show()
        {
         
           var text = "how to insert tab \t 123456789";
            document.getElementById("txtsp").value = text;
          
        }

Control Part:
       <textarea id="txtsp" name="txtsp" class="style1" ></textarea>
        <input type="submit" name="show" id="show"  value="Special Character" onclick="show();"/>

Output:
how to insert tab      123456789

No comments:

Post a Comment