Disable focus - jQuery

Is there a way to "disable" the focus of an element (textarea, input, contentEditable iframe)? I know that the blur function removes focus, but the user can just go back and focus it again.

I ask about this because there will be a point on my site where something like a tooltip will be requested (inside the page) . At this point, I want to lock the focus of all the text fields and inputs on the page and enable again when the user clicks "Cancel" or "Good."

Thank you very much!

+4
source share
1 answer

To prevent the user from focusing on the textarea or input element, you can disable it:

 $("#yourControlId").prop("disabled", true); 

I'm not sure about contentEditable iFrame

+1
source

Source: https://habr.com/ru/post/1391053/


All Articles