Avatar of AtDev
AtDev
 asked on

copy as you type from one field into another javascript

I'm looking for javascript that will dynamically copy one field that I am typing in into another field.

I have see other experts have come up with solutions but I can't seem to get it to work in firefox or ie6+
(https://www.experts-exchange.com/questions/21990368/Dynamic-Textboxes.html?sfQueryTermInfo=1+anoth+dynam+enter+field+javascript)
<html>
      <head>
            <script type="text/javascript">
                  var oldObj="";
                  function createNewText(obj){
                        if(document.getElementById(obj).value=="" && oldObj!=obj){
                              var nText=document.createElement('input');
                              nText.type="text";
                              nText.name="test"+(parseInt(obj.substring(4,obj.length))+1);
                              nText.id="test"+(parseInt(obj.substring(4,obj.length))+1);
                              nText.onkeypress=function(){createNewText(this.id);}
                              document.editentryform.appendChild(nText);
                              oldObj=obj;
                        }
                  }
            </script>
      </head>
<body topmargin="0" leftmargin="0">
      <form name="editentryform" method="post">
            <input type="text" value="" name="test1" id="test1" onkeypress="createNewText(this.id);">
      </form>
</body>
</html>

Open in new window

JavaScript

Avatar of undefined
Last Comment
Michel Plungjan

8/22/2022 - Mon
SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61