Javascript validation for multiple textboxes

前端 未结 4 1290
故里飘歌
故里飘歌 2021-01-24 07:12

I am having some trouble figuring out how to validate my textboxes using js. I have 10 textboxes, the user can fill out any number 1-10, but cant fill out 0. Here is the js th

4条回答
  •  佛祖请我去吃肉
    2021-01-24 07:38

    $('input[type="text"], select,
       :input[type="date"],
       :input[type="email"],
       :input[type="radio"]').each(function () {
    
      if ($.trim($(this).val()) == '' ) {
        // your error message here
        isValid = false;
      }
    
    });
    

提交回复
热议问题