We shall ignore usability for the moment… I have a long list of checkboxes and labels, except the labels are not <label> elements, but it’s all one horrid, uber-nested table structure. When a user checks a checkbox, another table of associated values is inserted below the current table. I want to alert the user that he/she should review the new table and check the relevant checkboxes there. The first time a box is checked, all is well. Unchecking a box works fine. Checking subsequent boxes though, causes to alert to reappear in increments of 4 times! (That is, 1st box produces 1 alert; 2nd box produces 4 alerts, 3rd box produces 8 alerts, etc.) Here is the code:
function checkThese(ckbx) {
"use strict";
var txtAlert = 'Please scroll down and select all the applicable\ncritical details pertaining to:\n\n';
var txtLabel = $(ckbx).closest('td').next('td').find('span').text();
window.location.hash = '#B_SH_CRTTSK_TBL$scrolli$0';
if ($(ckbx).prev('input').val() === 'A') {
alert(txtAlert + txtLabel);
}
}
I think so; this is actually a PeopleSoft application that’s been run through a tool that does most of the conversion to make the app responsive in design. Stand by…
I hope this screen capture is sufficient… Anyway, I had attached the listener function to all the checkboxes in this table. It works fine on the first box checked, and when you uncheck a box. When you check multiple boxes though, the JavaScript alert() appears 4 times for each box checked! <grr…>
Nope - I’m too lazy to type all of that in, and I’m likely to make tons of spelling mistakes that will not be representative of the problem you really are having.