javascript textbox call event when value changes

后端 未结 3 1494
予麋鹿
予麋鹿 2021-01-06 08:58

I have a textbox, and whenever the value of the box changes, I want to check and see if 20 digits have been entered.

I thought that I would use the onChange event, b

3条回答
  •  悲&欢浪女
    2021-01-06 09:55

    use onKeryPress event

      
    
        function CountText(field, maxlimit) 
        {
           if (field.value.length < maxlimit) // if too long...trim it!
            {
                return true;
            }
            else
              return false;
        }
    

    check my full article on : http://www.codeproject.com/KB/validation/MyTextBox.aspx

提交回复
热议问题