Performance of jquery visible
- by Mark Steudel
I have a bunch of checkboxes on a page, and I only show a subset of those checkboxes at a time.
I then perform some action which loops through all of the checkboxes and sees if they are checked or not:
e.g.
$(".delete_items").click( function() {
$('.checkboxes' ).each(function(){
//do stuff
}
}
Then I was thinking, well since the user can never interact with the hidden checkboxes, that adding :visible to checkboxes would speed up the loop
e.g.
$(".delete_items").click( function() {
$('.checkboxes :visible' ).each(function(){
//do stuff
}
}
But I don't know if adding :visible adds more overhead. Any thoughts?