internet explorer - Javascript check/uncheck all function. IE doesn't update -


function checkuncheckall(theelement) {         var theform = theelement.form, z = 0;         while (theform[z].type == 'checkbox' && theform[z].name != 'checkall') {                 theform[z].checked = theelement.checked;                 z++;         } } 

theelement checkall checkbox @ bottom of list of checkboxes. when clicked calls function set checkboxes in same form value of checkall.

it works across browsers aside 1 glitch in ie. after clicking checkall box seems checkboxes updated, don't see it. if click anywhere on page checkboxes updated proper status. happens both checking , unchecking.

this easy without jquery, unnecessary here.

function checkuncheckall(theelement) {     var formelements = theelement.form.elements;     (var = 0, len = formelements.length, el; < len; ++i) {         el = formelements[i];         if (el.type == "checkbox" && el != theelement) {             el.checked = theelement.checked;         }     } } 

update

it turned out main problem checkuncheckall() function being called change event handler on checkbox, doesn't fire in ie until checkbox loses focus, fix matter of changing use click event handler instead.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -