Skip to content
Advertisement

vuejs listing for events on disabled elements

How can I listen for events on a disabled element? I have an input box that I have disabled but that I want to enable if the user double clicks it. I know this is possible using a label and switching the label off using CSS. I want to know if there is a way to do this without a label – is there some way to disable the input and still handle events for it? or is there a way to make the input unfocusable unless double-clicked?

Advertisement

Answer

You can prevent the default action of the input with a timeout. If a user clicks before the ms has elapsed, you run the desired code:

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement