Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81688

How to simulate a live mouse click on the datatable...

$
0
0
If you want to use the same code regardless of the origin of the click.

$('#datatable_name tbody tr:eq(0) td:eq(0)').click() will simulate the same type of click the mouse click does in which the event.target is the Cell.

event.target = [object HTMLTableCellElement]
event.target.parentNode = [object HTMLTableRowElement] << We use the parentNode to check what row is selected

Simulating a click on the row, $('#datatable_name tbody tr:eq(0)').click(), isn't the same as the mouse click since the event.target is the row.

event.target = [object HTMLTableRowElement]
event.target.parentNode = [object HTMLTableSectionElement] << parentNode is not the row in this case.

Viewing all articles
Browse latest Browse all 81688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>