I want to get the values of selected check box row's value using Jquery.
For that, First I try to alert a message,if user checked the checkbox using Jquery. But I failed.
Note: I am adding checkbox in a row using Jquery, and then User will select the checkbox.
Here is my code to add checkbox in row through AJAX code
$('#btnSearchVendor').click(function(){
$.ajax({
type:"POST",
contentType:"application/json;charset=utf-8",
url: "GPCreateCheque.aspx/BindData",
data:"{}",
dataType:"json",
success: function (data) {
alert("success = "+data.d[0].DOCTYPE);
for(var i=0;i<data.d.length;i++){
$("#ContentPlaceHolder1_GridView1").append("<tr><td><input id=\"Checkbox"+i+"\" class=\"checkBoxClass\" type=\"checkbox\" /></td><td>" + data.d[i].DOCTYPE + "</td><td>" + data.d[i].DOCNUMBR + "</td><td>" + data.d[i].ActualAmount + "</td></tr>");
}
},
error:function(result){
alert("Error");
}
})
})
Jquery code to make alert when user select the checkbox
$('.checkBoxClass').click(function () {
alert("Checkbox state (method 1) = " + $('.checkBoxClass').prop('checked'));
//alert("Checkbox state (method 2) = " + $('.checkBoxClass').is(':checked'));
});
Above code is working fine, I added the checkbox. Below pic is the output with console