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>
$('#TextBox1').keydown(function(){
$('#TextBox2').val($(this).val())
})
$('#TextBox2').keydown(function(){
$('#TextBox1').val($(this).val())
})
var $tbs = $("input[id^='TextBox']");
$tbs.keyup(function() {
var that = this;
$tbs.each(function() {
$(this).val(that.value);
});
});
Demo: http://jsfiddle.net/SGcEe/2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With