I am working on a JavaScript function to disable all the dynamically generated html checkboxes in a table column. The little test function that I have works fine, but I need to be able to loop through and disable. It takes a paramter 'month' which is a number. The 'chk_xxx_month' is the dynamically generated id of the checkbox. The xxx is the id from the first column of a datatable. How do I write the JavaScript to disable all checkboxes with the month? Here is my JavaScript code.
function SelectAllProducts(month) {
if (document.getElementById("chk_0_" + month).checked) {
var chkBoxes
document.getElementById("chk_1309_" + month).disabled = true
document.getElementById("chk_1309_" + month).checked = false
document.getElementById("chk_1308_" + month).disabled = true
document.getElementById("chk_1308_" + month).checked = false
document.getElementById("chk_1307_" + month).disabled = true
document.getElementById("chk_1307_" + month).checked = false
} else {
document.getElementById("chk_1309_" + month).disabled = false
document.getElementById("chk_1308_" + month).disabled = false
document.getElementById("chk_1307_" + month).disabled = false
}
Thanks in advance.
function SelectAllProducts(month) {
if (document.getElementById("chk_0_" + month).checked) {
var chkBoxes
document.getElementById("chk_1309_" + month).disabled = true
document.getElementById("chk_1309_" + month).checked = false
document.getElementById("chk_1308_" + month).disabled = true
document.getElementById("chk_1308_" + month).checked = false
document.getElementById("chk_1307_" + month).disabled = true
document.getElementById("chk_1307_" + month).checked = false
} else {
document.getElementById("chk_1309_" + month).disabled = false
document.getElementById("chk_1308_" + month).disabled = false
document.getElementById("chk_1307_" + month).disabled = false
}
Thanks in advance.