Performance of jquery visible
Posted
by
Mark Steudel
on Stack Overflow
See other posts from Stack Overflow
or by Mark Steudel
Published on 2011-01-14T22:45:46Z
Indexed on
2011/01/14
22:53 UTC
Read the original article
Hit count: 201
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?
© Stack Overflow or respective owner