开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜