I'm trying to get the id and the status(checked or not) of a checkbox inside a clicked div.
<div class="ui toggle checkbox toggle_stat">
<input id="1" type="checkbox" ></input>
<label>Assesed</label>
</div>
<div class="ui toggle checkbox toggle_stat">
<input id="2" type="checkbox" ></input>
<label>Assesed</label>
</div>
<div class="ui toggle checkbox toggle_stat">
<input id="3" type="checkbox" ></input>
<label>Assesed</label>
</div>
then i have this script:
$(".toggle_stat").click(function() {
here is the part where i'm stuck:
var id = //code here for getting the id of the checkbox
var isChecked = //code here for getting the status of the checkbox
i already tried just using the $(":checkbox") but it's not working, i'm using a third party kitchensink.
$.ajax({
url: 'url',
type: 'post',
data: {id: id, checked: isChecked},
dataType: 'json',
success: function(response) {
},
error: function() {
}});
});
i would really appreciate guys a help. thank you
Aucun commentaire:
Enregistrer un commentaire