Click here to Skip to main content
12,400,183 members (58,999 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

2.5K views
Posted

Recent value with KeyPress

, 6 Sep 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
You can pass object as parameter to generalize function function showContent(e,object) { var recentChar...
You can pass object as parameter to generalize function

<asp:TextBox ID="txtName"  onkeypress="showContent(event,this)" ClientIDMode="Static" runat="server">
<label id="lblPrview" ></label>
 
<script type="text/javascript">
      function showContent(e,object) {
          var recentChar = String.fromCharCode(e.which);
          var completetext = object.value + recentChar;
 
           // assign value using js
          document.getElementById('lblPrview').innerHTML = completetext;
      }
  </script>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

AditSheth
Software Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160721.1 | Last Updated 6 Sep 2011
Article Copyright 2011 by AditSheth
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid