Reputation: 2262
I use onkeypress="return this.value.length"
that working fine. but i do copy and paste it keep on putting data in the text box. it should work for copy-paste operation too.
what i need to do for copy-paste operation to work for that too!
Upvotes: 0
Views: 890
Reputation: 3615
If you are looking for a way to limit what characters can be entered into a text box, you may find that the AjaxControlToolKit can help. It has a control called Filtered Textbox contro. Take a look at http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/FilteredTextBox/FilteredTextBox.aspx
Upvotes: 1
Reputation: 1098
Use below code to find length while typing
<input type="text" onkeyup="alert(this.value.length)" / >
Hope it helps !! :)
Upvotes: 1
Reputation: 12705
use onchange
with onkeypress
. so that whatever you have put there also executes on change
Upvotes: 0