Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert DOMElement Array to jQuery Object

I am using the DataTables plugin for jQuery and need to get one of the table rows. DataTables has a fnGetNodes function that returns an Array with all of the DOMElements of the table. I would like to use a jQuery selector to find that row (I know the id of the row), but I need to convert the Array to a jQuery Object, is this possible?

like image 550
Tim N Avatar asked Jun 05 '10 17:06

Tim N


1 Answers

To get a jQuery object from an Array of nodes, you can just pass it to jQuery:

var nodes = [document.documentElement, document.documentElement.firstChild];
var extendedNodes = $(nodes);
like image 120
Igor Zinov'yev Avatar answered Sep 21 '22 20:09

Igor Zinov'yev