I'm trying to write a reusable function to retrieve all data in a table that is passed to it and store it in an array.
I'm not sure how to pass the reference to the table.
I could do something like...
passTableRef($('#tableId th'),$('#tableId td'));
but I would like to pass just the table reference in case I would like to elaborate on the function.
Is there a way to pass $('#tableId')
and append the reference to $('#tableId th')
and $('#tableId td')
within the function?
EDIT: for clarification
I am wondering if you can take a reference - $(#tableId)
pass it to a function - reusableFunction($('#tableId'))
then do something like this..
function reusableFunction(table)
{
//change the selector $("#tableId") to $("#tableId th")
}