0

For some reason clicking with Jquery doesn't work with table TD elements in Electron. It works fine in a Chrome browser but not as an Electron app. All other elements are fine like div, li, span, button etc...only td doesn't work.

<td class="td">Test</td>

 $('.td').click(function (e) {
   console.log('test');
 });

Any ideas why this is?

Electron version 5.0.1.

Chromium version 73.0.3683.121

Hasen
  • 11,710
  • 23
  • 77
  • 135

1 Answers1

2

It's becuse td tag should be on real table (should have tr and table parent tags). like this:

<table>
  <tr>
    <td class="td">Test</td>
  </tr>
  <tr>
    <td class="td">Test</td>
  </tr>
</table>

Chrome will create tr tag for td tags if they are outside tr. but electron doesn't.

yaya
  • 7,675
  • 1
  • 39
  • 38
  • You're right it does work like that, the problem seems to actually be with elements created by electron. Even a simple button does not work if it's created with a jquery function. – Hasen Jun 06 '19 at 07:37