I have this piece of code in Javascript:
var len = 0;
$('#list > input').each(function() {
if($(this).attr('checked')) len++;
});
if(!len) {
alert("{$err.no_list_chosen}");
return false;
}
return checkFormAdd();
It should iter the list of checkbox to be sure that AT LEAST one is checked, otherwise, return Error.
All this is not working on Internet Explorer 8, and maybe on 7 too.
Can someone help me to rewrite the code so that it could be good for all the browsers?
Please, just use one line:
It works in all browsers, just like your code, but this is without the spaghetti…