Tuesday, 8 January 2013

Onkeypress textbox and value show in label

 Onkeypress on textbox and value show in label

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup,
  menu, nav, section { display: block; }
</style>
<script type="text/javascript">
    $(function () {
        $('#txt1').keyup(function () {
         $('#output1').text($(this).val());
         $('#p1').text($(this).val());
        });
        $('#txt2').keyup(function () {
            $('#output2').text($(this).val());
            $('#p2').text($(this).val());
        });
        $('#txt3').keyup(function () {
            $('#output3').text($(this).val());
            $('#p3').text($(this).val());
        });
    });

</script>
</head>
<body>
<form id="form1" runat="server">
 <%-- <input id="txt1" type="text" />--%>
  <asp:TextBox ID="txt1" runat="server"></asp:TextBox><br />
  <asp:Label ID="output1" runat="server"></asp:Label><br />
   <asp:TextBox ID="txt2" runat="server"></asp:TextBox><br />
  <asp:Label ID="output2" runat="server"></asp:Label><br />
   <asp:TextBox ID="txt3" runat="server"></asp:TextBox><br />
  <asp:Label ID="output3" runat="server"></asp:Label>
  <br /><br />
 
   <div>
   <p id="p1"></p><br />
    <p id="p2"></p><br />
     <p id="p3"></p>
   </div>

  </form>
</body>
</html>

No comments:

Post a Comment