Solved

Split table first and rest

Posted on 2013-12-05
1
196 Views
Last Modified: 2013-12-20
Im trying to split a table into first and rest rows, however my code doesnt seem to pull any rows:-
        function modTable($tableID) {
	        var $firstRow = $('#' + $tableID.id + ' tr:first');
	        var $restRows = $('#' + $tableID.id + ' tr').not(':first');
		}
        modTable($('#myTableID'));

Open in new window


Any ideas what Im doing wrong?

Thank you in advance
0
Comment
Question by:tonelm54
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39699467
Use :
        function modTable($table) {
	        var $firstRow = $('#' + $table.attr("id") + ' tr:first');
	        var $restRows = $('#' + $table.attr("id") + ' tr').not(':first');
		}
        modTable($('#myTableID'));

Open in new window


Or better :
        function modTable($table) {
	        var $firstRow = $('tr:first', $table);
	        var $restRows = $('tr:gt(0)', $table);
		}
        modTable($('#myTableID'));

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now