Prashant Sharma Prashant Sharma - 4 months ago 41
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.


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"/>