Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NETJavascript
i can not access the first letter of the text box when calling a java script function
in the text box key press event
Posted 2 Oct '12 - 20:19

Comments
_Amy - 3 Oct '12 - 2:40
Which code you are using? We are not having access to your HDD. So, while asking the question please try to incorporate your sample code in the question. So that we can understand your question and solve the problem.
Arunprasath Natarajan - 4 Oct '12 - 10:58
Place your code here.

3 solutions

provide more details about your problem.i think you get problem while accessing keypressed character when key is pressed first time according to this i am providing you following a soln:
 
.aspx code
<asp:TextBox ID="txtUserId" runat="server" onkeyPress="return myfunction(event)></asp:TextBox>
 
javascript:
function myfunction(e)
{
    var a=e.keyCode;
}
 

}
 
this e.keyCode gives you key pressed.i hope it will works
  Permalink  
Comments
Nikhil Paulson - 3 Oct '12 - 2:57
i want to perform a percentage validation,so i want to check whether the entered value is greater than 100 or not
Durgapasad - 4 Oct '12 - 8:54
write e.keychar in keyup event of textbox
can u tell what code r u using ?
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 333
1 OriginalGriff 261
2 Mohammed Hameed 198
3 Mayur_Panchal 153
4 Dave Kreskowiak 125
0 Sergey Alexandrovich Kryukov 8,171
1 OriginalGriff 6,236
2 CPallini 3,482
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 3 Oct 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid