Set Dynamically value OnChecked in hidden field (set or remove hidden field on checked)

ThinkToApply

function SetCheckboxID(senderid) {
if ($(senderid).prop(‘checked’)) {
$(“[id$=hdInvoiceNo]”).val($(“[id$=hdInvoiceNo]”).val() + $(senderid).val() + “,”);
}
else {
var loglist = $(“[id$=hdInvoiceNo]”).val().split(‘,’);
if (loglist.length > 1) {
$(“[id$=hdInvoiceNo]”).val(”);
for (var i = 0; i < loglist.length – 1; i++) {
if (loglist[i] != $(senderid).val()) {
$(“[id$=hdInvoiceNo]”).val($(“[id$=hdInvoiceNo]”).val() + loglist[i] + “,”);
}
}
}
}
}

View original post

Advertisements