When js blocks the "backspace" and "enter" keys on the whole page, can it be left unblocked in the red box alone?

Apr.11,2021

something like this:

var $textarea = document.querySelector('-sharpfoo')

document.addEventListener('keydown', function(event){
  var needPrevent = true
  var tar = event.srcElement || event.target

  if(event.keyCode == 8) {
    if($textarea == tar) {
      needPrevent = false
    }
    
    if(needPrevent) {
    event.preventDefault();
    return false;
    }
  }
})
The idea of

is very simple, that is, to determine which source node of the trigger event is. I simply use = = to make a reference comparison about the logic of the decision, which can be extended to custom logic.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b380e8-2c0ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b380e8-2c0ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?