How do I limit the user's click on table cell ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I limit the user's click on table cell ?

When I had to limit the clicks of a button I did it by making a variable counter and increasing it on every click ,when it reaches 4 js disables the button but here I have to disable a <td> which I am not able to do so can somebody help?

1st Jun 2017, 6:09 PM
_Retr0/-
_Retr0/- - avatar
9 Answers
+ 13
document.getElementsByTagName("td")[0].style.pointerEvents="none"; //tip: Don't disable clicking, just prohibit writing....
1st Jun 2017, 6:44 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
hide the table cell could be an idea?
1st Jun 2017, 6:23 PM
Emore Anzolin
Emore Anzolin - avatar
+ 2
why should someone click on table cell?
1st Jun 2017, 6:35 PM
Emore Anzolin
Emore Anzolin - avatar
+ 2
use a flag and set it to 1 to not execute the code function assign(x) { if(flag == 0) { var y = "" if(x == "1") { y = "1" clicklimit(); ...... }
1st Jun 2017, 6:45 PM
Emore Anzolin
Emore Anzolin - avatar
+ 1
still waiting for the answer 😐😐😐
1st Jun 2017, 6:19 PM
_Retr0/-
_Retr0/- - avatar
+ 1
nope 😐
1st Jun 2017, 6:32 PM
_Retr0/-
_Retr0/- - avatar
+ 1
he will here is my code https://code.sololearn.com/WH1dAbhm8xzw/?ref=app try clicking on the table cell
1st Jun 2017, 6:39 PM
_Retr0/-
_Retr0/- - avatar
+ 1
actually here is the main code the previous one is designed for better ui (yeah the previous one doesn't function properly) https://code.sololearn.com/W92xHw224bgd/?ref=app
1st Jun 2017, 6:43 PM
_Retr0/-
_Retr0/- - avatar
+ 1
yeah disabling doesn't work for <td>
1st Jun 2017, 6:45 PM
_Retr0/-
_Retr0/- - avatar