How to simulate a live mouse click on the datatable...
How to simulate a live mouse click on the datatable...
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.
$('#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.
This discussion has been closed.