Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Created November 29, 2022 19:43
Show Gist options
  • Save yuriinalivaiko/220febbfb39509960586a6b75d034ad1 to your computer and use it in GitHub Desktop.
Save yuriinalivaiko/220febbfb39509960586a6b75d034ad1 to your computer and use it in GitHub Desktop.
This code sends a private message when the user presses the ENTER key.
/**
* Send private message on ENTER.
* Add this code to your custom JS file.
*/
jQuery( document.body ).on( 'keypress', 'textarea.um_message_text', function ( event ) {
if ( event.keyCode && event.keyCode === 13 || event.which === 13 ) {
jQuery( event.target ).closest( '.um-message-footer' ).find( '.um-message-send' ).trigger( 'click' );
}
} );
@yuriinalivaiko
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment