My Javascript is quite basic, but for some reason I am having trouble. I have a table that is dynamically being built and the goal of my script is to select the last 5 rows if there are more then 10 total rows and apply a CSS style to those final five. I built a stripped down example where the first 5 rows should be made blue and the last 5 rows made red. http://jsfiddle.net/helpinspireme/3zCp8/
There is probably a much better way to do this. Any help would be appreciated.
ANSWER:
Using slice() allowed me to accomplish my goal. That can be seen here: http://jsfiddle.net/helpinspireme/3zCp8/ Thank you Kevin B.
For what you explained you are trying to do in your question, the simplest way to accomplish it is:
http://api.jquery.com/slice