Jquery/Javascript event trigger does not seem to trigger the active element.
I have a play/pause button and am trying to toggle between them via Javascript. When using my physical keyboard and hit the Enter key, I see that it toggles between them. When trying to trigger it via code, it seems to not actually do anything.
A few things I have tried:
jQuery.event.trigger({type: 'keyup', which : 13});
jQuery.event.trigger({type: 'keydown', which : 13});
document.activeelement.dispatchEvent(new KeyboardEvent('keypress',{'key':'enter'}));
I would think one of these would actually act like the enter key and press the play/pause.
Any ideas?