Wednesday, December 12, 2012

Copy text in Jquery

Lets say we have two text boxes. One is a password textbox and other is a plain textbox. What we are going to achieve is when you type some text on the password text box and the focus goes out, the text you have typed in the password textbox will be appeared on the plain text box.

Below is our code.

<html xmlns="">
<head runat="server">
    <script src="jquery-1.8.3.js" type="text/javascript"></script>
      <script type="text/javascript">
        $(document).ready(function () {
            $("#txthdnPassword").attr('readonly', 'readonly');
            $("#txtPassword").blur(function () {
    <form id="form1" runat="server">
    Password: <input type="password" id="txtPassword" /><br />
    Password in Text: <input type="text" id="txthdnPassword" /><br />

$("#txthdnPassword").attr('readonly', 'readonly');
Making the plain textbox read only.


Capturing the event when the focus goes out from the password text box.

Writing Password text to the plain textbox.

No comments:
Write comments
Recommended Posts × +