Search code examples
jqueryasp.nettextchangedtextbox

Text change events in jquery with Asp.net


I have 2 textboxes and If I write anythng in textbox1 it should reflect immediately in textbox2 and If I write anything in textbox2 it should reflect in textbox1.

So how do I do that? I have seen this article before and how to Implement between two textboxes?

http://www.zurb.com/playground/jquery-text-change-custom-event

Here are my textboxes:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

Solution

  • $('#TextBox1').keydown(function(){
        $('#TextBox2').val($(this).val())
    })
    $('#TextBox2').keydown(function(){
        $('#TextBox1').val($(this).val())
    })