Click here to Skip to main content
15,889,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all i need javacript for typing the word automatically when user enter a text in textbox1 it should display automatically in textbox2. Can any one give me the Javascript
Posted

I got the answer


XML
<script type="text/javascript">
function sync()
{
  var n1 = document.getElementById('TextBox1');
  var n2 = document.getElementById('TextBox2');
  n2.value = n1.value;
}
            </script>
 
Share this answer
 
Comments
Wonde Tadesse 21-May-11 12:34pm    
How the sync works ? Unless you call it on some event. :(
Here is what you looking for

Put this code in Header section.

XML
<script type="text/javascript">
       function myValue(t1) {
           document.getElementById("<%=t2.ClientID %>").value = t1.value;
       }
   </script>


Put the code in Body

XML
<input id="t1" type="text" runat="server" onkeypress="javascript:myValue(this)" />
<input id="t2" type="text" name="name" runat="server" value="" />


I hope this helps you well.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900