I need to prevent users from hitting the enter key if the cursor is in certain positions:
this.contentArea.addEventListener('keypress', e => {
if (e.keyCode == 13) {
if (insideForbiddenElement)
e.preventDefault();
}
});
Is there a way to consistently get this? It only needs to work in the latest firefox / chrome.