Go back only if focused input is empty
This commit is contained in:
parent
1b1c2dba77
commit
6095314341
1 changed files with 1 additions and 1 deletions
2
back.js
2
back.js
|
@ -1,6 +1,6 @@
|
|||
window.addEventListener('load', function (e) {
|
||||
this.document.body.addEventListener('keydown', function (e) {
|
||||
if (e.key == 'Backspace') {
|
||||
if (e.key == 'Backspace' && (e.target.tagName.toUpperCase() !== 'INPUT' || e.target.value.length === 0)) {
|
||||
e.preventDefault()
|
||||
window.history.back()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue