Reputation: 53
In either Javascript or HTML, is there a way to disable all user input except for a selection of keyboard presses? For example, if I trigger an error that shows a popup error message, is there a way to block any other user input into the DOM in the backround until the user has dismissed the popup using the Enter key?
Thank you all in advance!
Upvotes: 2
Views: 1381
Reputation: 1330
If I understand you correctly, you might want to disable keyboard and mouse activity beyond the modal when opening like with this related question. Here is the summary of the options included:
If you opening the modal by js use:
$('#myModal').modal({backdrop: 'static', keyboard: false})
If you are using data attributes, use:
<button data-target="#myModal" data-toggle="modal" data-backdrop="static" data-keyboard="false">
Launch demo modal
</button>`
Upvotes: 2