Reputation: 41
Is there any way to "disable" focus of an element (textarea, input, contentEditable iframe)? I know the blur function takes away the focus, but the user can just go back and focus it again.
I'm asking this because there will be a point in my site where a sort of a prompt (inside the page) will ask for something. At this moment, I want to block the focus of all textareas and inputs in the page, and allow it again when the user press "Cancel" or "Ok".
Thank you very much!
Upvotes: 4
Views: 7874
Reputation: 83358
To prevent the user from focusing an textarea
or input
element, you can disable it:
$("#yourControlId").prop("disabled", true);
I'm not sure about a contentEditable iFrame
Upvotes: 1