I want to show the multiple value of checkbox in a div or textbox.
function countChecked() {
var n = $("input:checked").val();
$("div").text(n + (n === 1 ? " is" : " are") + " checked!");
}
countChecked();
$(":checkbox").click(countChecked);
try this:
function countChecked() {
var n = 0;
$(":checkbox:checked").each(function(){
n += parseInt(this.value, 10)
})
$("div").text(n + (n === 1 ? " is" : " are") + " checked!");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With