Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FareedR's avatar

how can I change id for multiple checkbox

based on my use case , user can add more "contradict" which is an array . somehow . the id does not change after using clone() method . and i need to change label for too , to make checkbox function.

//blade
<div class="col-3 mt-2">
   <div class="checkbox checkbox-danger-custom">
        <input id="contradict" type="checkbox" name="contradict[]" value="1">
        <label for="contradict">Contradict</label>
  </div>
</div>

// javascript
var a =_clone.find('.check checkbox-danger-custom').find('#contradict').attr('contradict','contradict'+x);
0 likes
0 replies

Please or to participate in this conversation.