Reputation: 75
I had a Accept button on my modal, what I want is when I press Accept automatically it will give 'checked' attribute to the #check-agree
id, but the problem here is I don't know how to reach #check-agree
from .modal-accept
here is my code :
<div class="form-check">
<input type="checkbox" class="form-check-input" id="check-agree">
<label class="form-check-label" for="check-agree">Agree our <a data-toggle="modal" data-target="#exampleModalCenter" href="">terms and conditions</a></label>
</div>
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-footer">
<button type="button" class="btn btn-primary modal-accept" data-dismiss="modal">Accept</button>
</div>
</div>
</div>
</div>
<script>
$(".modal-accept").click(function(){
$('#check-agree').attr("checked")
});
</script>
Upvotes: 0
Views: 43