Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when user writes something in textbox say "hello" only "hell" is displayed in label, only after typing next character the label displays "hello"..plzz help me!!
my code is
XML
function settext1(val) {

          document.getElementById('<%=Label6.ClientID%>').innerHTML = val;
      }


XML
<asp:TextBox id="txtbox1" runat="server" class="water" Text="Text Line 1" Tooltip="Enter Text" onkeypress="settext1(this.value)"></asp:TextBox><br />
Posted

1 solution

Change keypress to keyup:

<asp:TextBox id="txtbox1" runat="server" class="water" Text="Text Line 1" Tooltip="Enter Text" onkeyup="settext1(this.value)"></asp:TextBox><br />


see my fiddle code (using jquery):-
http://jsfiddle.net/z24Um/29/[^]
 
Share this answer
 
Comments
jin19 6-Aug-14 3:29am    
thank you :)
TrushnaK 6-Aug-14 3:36am    
Welcome..

If its helpful to you then mark it as answer. So others also gets the help.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900