+ 6

Determine if click event exist on td and change cursor to pointer

We have a bunch of html pages with a click event attached to table / td(s) and it is not user friendly at all. Most of the pages are using Dynatable plugin to load and display data in those tables. Now, is there a simple way to determine which tables/td(s) have a click event attached to them and change the cursor style to a pointer on that td(s)?

20th Mar 2019, 2:31 AM
Dejan Dozet
Dejan Dozet - avatar
4 Antworten
+ 6
20th Mar 2019, 3:01 AM
Dejan Dozet
Dejan Dozet - avatar
+ 6
Thanks Calviղ but that is not helping, if you are interested please look at my solution I am quite happy with it, it covers all to(s) on a page even if they are dynamically loaded, thanks again
20th Mar 2019, 4:05 AM
Dejan Dozet
Dejan Dozet - avatar
+ 5
I think my solution also can cover dynamically loading, just run and test it, some more i think for simple solution, always go for pure js, rather than loading a whole jquery for a simple task. Btw, your task is simple to solve by using a css only, without using any js Just add td[onclick] { cursor: pointer; } Just hope it help. Cheers
20th Mar 2019, 4:10 AM
Calviղ
Calviղ - avatar
+ 3
Try this var table = document.getElementById("table") table.addEventListener("click", onClick, false) function onClick(event) { if(event.target.tagName === "TD") event.target.style.cursor = "pointer" } https://code.sololearn.com/WGD3b8GmSdE9/?ref=app
20th Mar 2019, 3:27 AM
Calviղ
Calviղ - avatar