Answers for "js contenteditable button spacebar"

0

js contenteditable button spacebar

const button = document.querySelector('button[contenteditable]')

button.addEventListener('keydown', function (event) {
  if (event.code !== 'Space') {
    return
  }
  event.preventDefault()
  document.execCommand("insertText", false, ' ')
})
Posted by: Guest on August-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language