Thursday, February 21, 2013

Clone the Contents of a ASP.NET TextBox into another TextBox using jQuery

.aspx Markup:

<form id="form1" runat="server">
<div class="smallDiv">
<h2>Enter text in the top textbox to see it cloned in the
bottom textbox</h2>
<br />
<asp:TextBox ID="tb1" runat="server" />
<asp:TextBox ID="tb2" runat="server" />
<br />
Tip: Entering text in bottom box does not do anything.

Jquery Script:
<script type="text/javascript">
$(function() {
$('input[id$=tb1]').keyup(function() {
var txtClone = $(this).val();

When the user type on the first text box same value will be cloned into the second text box.

No comments:
Write comments
Recommended Posts × +