Reply To: Enter Button Not Working When Trying to Send a Message


Home Forums Front End PM PRO Enter Button Not Working When Trying to Send a Message Reply To: Enter Button Not Working When Trying to Send a Message

#23719
shamim
Keymaster

Add following code in your theme’s (child theme’s if you are using) functions.php

add_action( 'fep_after_form_fields', function( $where, $errors, $fields ){
	if( in_array( $where, [ 'newmessage', 'reply' ] ) ) {
		?>
		<script type="text/javascript">
		document.addEventListener("keyup", function(event) {
			// Number 13 is the "Enter" key on the keyboard
			if (event.keyCode === 13) {
				// Cancel the default action, if needed
				event.preventDefault();
				document.querySelector('.fep-form').submit();
			}
		}); 
		</script>
		<?php
	}
}, 10, 3);