Text area validation?
I want to validate my text are while entering data.
I had written code for on keypress
event.
function validateQuestionTextArea(questionid)
{
var txtbx=$('questions-'+questionid).value;
if(txtbx.开发者_开发技巧length > 99)
{
showValidationMessage('questionMaxLengthValidation');
return false
}
return true
}
The problem with this is that I can use backspace or delete once it reached the 100.
Which event should I use?
you might wanna use KeyUp instead ^^
see jquery way similar question.. or follow below steps
first get the data then trim from both side then count and compare with max length
精彩评论