Revision: 43920
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 3, 2011 08:38 by bullzito
Initial Code
//HTML <div>Index 0</div> <div>Index 1</div> <div>Index 2</div> <div>Index 3</div> <div>Index 4</div> //SCRIPT $(document).ready(function(){ //get the number of DIV's var divCount = $('div').length; //check to see if the count is greater than 3 if (divCount > 3) { //count starts at zero (0, 1, 2...) $('div:gt(2)').css('background','darkOrange'); } });//jQuery
Initial URL
http://marioluevanos.com/playground/Select%20Lenght%20of%20Elements/
Initial Description
Useful if you want to manipulate/style/remove items after a given index count.
Initial Title
Select/Traverse based on Length of Elements
Initial Tags
Initial Language
JavaScript