jeudi 26 mars 2020

I want to get the value of each attr('selector') using the .prevUntil() and pass it into an array in jquery

I want to get the value of each attr('selector') using .prevUntil() and pass it into an array in jQuery.

<script>
  $(document).ready(function() {
  $(document).ready(function() {
  `
<script>
      var checkbox = "check";
      $(document).on('click', '.'+checkbox, function() {
        var old = $(this).attr('class');
        var new_class = 'start';
        $(this).addClass(''+new_class);
        var added = $(this).attr('class');
        alert($('input.stop').nextUntil('input.'+new_class).attr('name'));
      });
    });
</script>
</head>

<body>
  <input class="form-control form-control-user check stop" value="0" type="checkbox" name="scsf_i">
  <input class="form-control form-control-user check" value="0" type="checkbox" name="scsf_ii">

  <input class="form-control form-control-user check" value="0" type="checkbox" name="scsf_iii">

  <input class="form-control form-control-user check" value="0" type="checkbox" name="form_a">

  <input class="form-control form-control-user check" value="0" type="checkbox" name="ungraded_i">

  <input class="form-control form-control-user check" value="0" type="checkbox" name="graded_i">
</body>
</html>



Aucun commentaire:

Enregistrer un commentaire