here i am writing the code like this but unable to get selected checkbox value.if anyone knows how to get selected checkbox value.
$(function () {
$('#chkType').click(function () {
var checked = $("#chkType").is(':checked');
alert(checked); return false;
});
});
});
});

Joginder BangerPosted Nov 14, 2014, 6:03 AM
$('#CheckBox1').click(function (e) {
if( $("#CheckBox1").is(':checked'))
alert($("#CheckBox1").next('label').text());
else
return false;
});
});
alert the message acbus.
Jitendra KumarPosted Nov 14, 2014, 6:03 AM
$("#CheckBus").on("click",function () {
$("#parentId").find('input[type="checkbox"]').each(function(){
if ($(this).prop('checked')==true){
alert($(this).prop('id') +" is checked")
}
else
{
alert("Please check checkbox")
}
});
});
Or check this link:
http://jsfiddle.net/ah1qq654/1/
Sarath KumarPosted Nov 14, 2014, 5:49 AM
for example,bus type Ac,NonAc is there.if i check Ac i need to print "Ac".got it...
Joginder BangerPosted Nov 14, 2014, 5:35 AM
Sarath KumarPosted Nov 14, 2014, 5:33 AM
Joginder BangerPosted Nov 14, 2014, 5:28 AM
function myfun() {
var temp =document.getElementById("CheckBox1").checked;
alert(temp);
}
jquery used
var temp= $("#CheckBox1").is(':checked');
alert(temp);
it's working on my machine.
Joginder BangerPosted Nov 14, 2014, 5:04 AM