sajad torkamani
// Create a keyboard event for the space key
const spaceEvent = new KeyboardEvent('keydown', {
  key: ' ',
  keyCode: 32,
  code: 'Space',
  which: 32,
  bubbles: true,
  cancelable: true
});

// Dispatch the event on the target element or document
document.dispatchEvent(spaceEvent);
Tagged: JavaScript

Leave a comment

Your email address will not be published. Required fields are marked *