Solved

Split table first and rest

Posted on 2013-12-05
1
203 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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 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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

831 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