Created
November 29, 2022 19:43
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is a part of the article Send private message on ENTER
Documentation: https://docs.ultimatemember.com/
Support forum: https://wordpress.org/support/plugin/ultimate-member/