Recently I am facing issues for textarea is not supported to max length attribute to tag.
So I need to do manually restrict allow max length character using jQuery keypress event.
So when we are try to write anything under that textarea it will fire the keypress event on jQuery side.
Let's see example of keypress event and how to handle text length for any input control.
When you start writing under textarea it will allow you to write only 256 character.
Why I have return this blog because many developer does not know about this feature is not supported by textarea by default.
Hope this post help to you. Please keep reading my blog post and help to improve this blog.
So I need to do manually restrict allow max length character using jQuery keypress event.
Here we have one textarea and define id as txtcomment. so I am going to attached keypress event for textarea.
So when we are try to write anything under that textarea it will fire the keypress event on jQuery side.
Let's see example of keypress event and how to handle text length for any input control.
function restrictLenght() { var tval = $('#txtcomment').val(), return tval.length < 250; }
When you start writing under textarea it will allow you to write only 256 character.
Why I have return this blog because many developer does not know about this feature is not supported by textarea by default.
Hope this post help to you. Please keep reading my blog post and help to improve this blog.
0 comments:
Post a Comment