Prashant Sharma Prashant Sharma - 1 year ago 78
HTML Question

Copy only text from one textbox to another textbox using javascipt

I want to copy value of one textbox to another textbox using javascript. When user type value in first textbox then it should automatically copy into another textbox,

Now what my requirement is:
If user type text only then it should copy into another textbox.
If user type numbers then it should not be copied into another one.

Answer Source

var firstText=document.getElementById('firstText'),
  var val=this.value;
  secondtext.value=val.replace(/[0-9]/g, "");
<input id="firstText" type="text"/>
<input id="secondText" type="text"/>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download