Hello Flesler, Yes, you got want I would like to do. So when I load a form, I first check the input checkbox if there are checked or not
On Nov 14, 10:30 pm, Flesler <[EMAIL PROTECTED]> wrote: > Can you make a model of your situation ? that could help. > What do you want to do exactly? to show/hide many tds when a checkbox > is clicked? and changeBg(), that's for creating a zebra-like striping > of the cells ? > First of all, if you want to show ALL the cells in a table, or a row, > you can just toggle the table or the row. That's surely faster. Maybe > this helps... > > function myToggleShow( checkbox, targets ){ > targets = $(targets); > $(checkbox).click( function() { > if ( this.checked ){ > targets.show('slow'); > changeBg(); //is really neccesary to call this EVERY time you > click the checkbox? > } else { > targets.hide('slow'); > } > }).triggerHandler('click'); > > } > > myToggleDisplay('#myCheckboxID', 'td.areaToShow'); > > Ariel Flesler > > On 14 nov, 13:54, Snook <[EMAIL PROTECTED]> wrote: > > > Dear developers, > > > I have a function which is called several times, when my page is > > loaded. This is VERY slow under IE, because I have a lot of checkbox. > > > Did someone can explain me this difference between FF and IE ? And > > maybe how to improve this function : > > > function myToggleShow(checkboxElem, showHideElem){ > > var showHide = $(showHideElem); > > var checkbox = $(checkboxElem); > > checkbox.click( function() { > > if (checkbox.is(":checked")) { > > showHide.show('slow'); > > > // Change the background for "even" lignes > > changeBg() > > } else { > > showHide.hide('slow'); > > } > > }); > > > // check the checkbox status when the form is loaded > > if (checkbox.is(":checked")) { > > showHide.show('slow'); > > } > > > } > > > myToggleDisplay('#myCheckboxID', 'td.areaToShow'); > > > FYI, I cannot use the toggle function, which didn't work with > > checkbox !!! > > > Thanks, > > > Damien