This function wires the fourth instance of a dynamic control (a ListBox with select all/unselect all buttons):
function pageLoad() {
$('#MainContent_lbx4_AllLB').live("click", function () {
$('#MainContent_lbx4_RegionTypeLB').find('option').attr('selected', true);
});
$('#MainContent_lbx4_NoneLB').live("click", function () {
$('#MainContent_lbx4_RegionTypeLB').find('option').attr('selected', false);
});
}
I works but like I mentioned, it only works on the fourth instance. How I can I find how many of them there are on the page, and use that number to loop through and wire them all ?