Get jQuery object from table row click Check out the fiddle here.  This JavaScript will take the row that a user clicks on and make an object with the key coming from the thead element in the table and the value coming from the data in the text in the table cell value.  I'm looking for a more professional/succint way of doing this: 

JS

$(document).ready(function () {
            $('tr').click(function () {
                var tableData = $(this).children('td').map(function () {
                    return $(this).text();
                }).get();
                var props = $('thead &gt; tr th');
                var array = [];
                props.each(function () { array.push($(this).text()) });
                //keys
                console.log(array);
                //values
                console.log(tableData);

                var obj = {};
                for (var i = 0; i &lt; tableData.length; i++) {
                    obj[array[i]] = tableData[i];
                }
                console.log(obj);
            });

        });


HTML

&lt;table cellspacing="0" rules="all" border="1" style="border-collapse:collapse;"&gt;
        &lt;thead&gt;
            &lt;tr&gt;
                &lt;th scope="col"&gt;PersonId&lt;/th&gt;&lt;th scope="col"&gt;FirstName&lt;/th&gt;&lt;th scope="col"&gt;LastName&lt;/th&gt;
            &lt;/tr&gt;
        &lt;/thead&gt;&lt;tbody&gt;
            &lt;tr&gt;
                &lt;td&gt;1&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Doe&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;
                &lt;td&gt;2&lt;/td&gt;&lt;td&gt;Jane&lt;/td&gt;&lt;td&gt;Doe&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;
                &lt;td&gt;3&lt;/td&gt;&lt;td&gt;Time&lt;/td&gt;&lt;td&gt;Smith&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/tbody&gt;
    &lt;/table&gt;
The selector $('thead &gt; tr th') is not specific enough, if you have multiple tables in the page.  You want the headings of the same table that was clicked: $(this).closest('table').find('thead &gt; tr th').

var array is an unsatisfying name.  I can see that it's an array — but what does it do?  How about calling it tableHeadings?

You formed tableData using Array.map(); why not do the headings the same way?

var tableHeadings = $(this).closest('table')
                           .find('thead &gt; tr th')
                           .map(function() {
    return $(this).text();
}).get();