I have some checkboxes and want to add their value into JQuery. I have been able to retrieve the value but it gets every checkbox value with the .each jquery command. I wasn't sure how to get only the value of that specific checkbox that is checked so I can use the append command to display the data.
The checkbox:
<input id="add_policies_checkbox<?php echo $row[toolID]; ?>" type="checkbox" />
The button that submits the form for JQuery to handle:
<input type="button" name="action" class="btn btn-success checkboxadd" value="Add Policy" />
JQuery - Not sure how to get only the information (value) from the add_policies_checkbox that is checked:
$(".checkboxadd").click(function(){
$('[id*="add_policies_checkbox"]').each(function(){
//alert(this.value);
var data=this.value;
$("#div_to_add_this_checkbox_value").append("Info added"+data);
});
});//end ajaxifypolicies
Aucun commentaire:
Enregistrer un commentaire