lundi 27 août 2018

how to validate checkbox and radio button in jquery

I am unable to validate the checkbox and radio button. Actually i just need to insert validation for user at least select one thing weather checkbox or radio. see my code. that's not working for me.

<script>
  $(".submit").click(function(){
       var checkBoxCount = $(".jobwork:checkbox:checked").length;
      if($(".jobwork:checkbox:checked").length < 1 || ($("input[name=jobwork]:checked").length <= 0)){
          alert("Please select atlease one jobwork");
          return false;

      };

  })




Aucun commentaire:

Enregistrer un commentaire