Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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, ' ')
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #contenteditable #button #spacebar
ADD COMMENT
Topic
Name
8+6 =