Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

disable click

altrue990
Level 4
Level 4

I have a button that should only be clicked once. Once it is clicked, it needs to be disabled (i.e. click event should not be fireable). I have JavaScript that I thought accomplished this:

this.access = "readOnly";

But it appears this only disables the ability to "click" using the mouse. The button is still focusable and enter causes the click event to fire.

1 Accepted Solution
MinusZero
Correct answer by
Level 7
Level 7

Hi,

Instead of readOnly use protected. This will disable all functions of the button and also exclude it from being focussed on when using the TAB key.

this.access = "protected";

View solution in original post

1 Reply
MinusZero
Correct answer by
Level 7
Level 7

Hi,

Instead of readOnly use protected. This will disable all functions of the button and also exclude it from being focussed on when using the TAB key.

this.access = "protected";

View solution in original post