LoginSignup
9
8

More than 5 years have passed since last update.

複数のチェックボックスが全て1つ以上選択されているかでバリデーションするJquery

Last updated at Posted at 2014-10-18
js
$(function () {
   //送信ボタンを押したときにバリデーション
   $(".submit_button").click(function(){
      if( $(".checkbox_wrapper1").find('input[type="checkbox"]:checked').size()==0 ||
          $(".checkbox__wrapper2").find('input[type="checkbox"]:checked').size()==0){
            alert("チェックボックスが1つ以上選択されていません");
            return false;
        }
   }
});

htmlは省略

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8