Title: adding onclick to table rows
Last modified: April 6, 2017

---

# adding onclick to table rows

 *  Resolved [gatta2](https://wordpress.org/support/users/gatta2/)
 * (@gatta2)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/adding-onclick-to-table-rows/)
 * Hi, is it possible to add onclick to <tr> so that we can have expandable table
   rows? e.g. [http://talkerscode.com/webtricks/expand-table-rows-using-jquery-html-and-css.php](http://talkerscode.com/webtricks/expand-table-rows-using-jquery-html-and-css.php)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/adding-onclick-to-table-rows/#post-9000564)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * No, adding a direct `onclick` attribute is not possible, and this would actually
   be bad JavaScript code. Instead, you should probably add event handlers using
   e.g. the jQuery library in your script, like
 *     ```
       jQuery( '.tablepress-id-123' ).on( 'click', 'tr', function() {
         ...
       } );
       ```
   
 * Regards,
    Tobias

Viewing 1 replies (of 1 total)

 The topic ‘adding onclick to table rows’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/adding-onclick-to-table-rows/#post-9000564)
 * Status: resolved