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

This topic is: Not Resolved

This topic contains 3 replies, has 2 voices, and was last updated by  shamim 3 weeks, 5 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23658

    Jon Harari
    Participant

    How can we make the “Enter” button submit the message form when entering a message in the message box? Right now it is not working.

    #23678

    shamim
    Keymaster

    If you use “Textarea” editor in Front End PM PRO > Settings > General > Editor Type then i can write some code for you to achieve this. Otherwise it is not possible.
    Let me know if you need code.

    #23716

    Jon Harari
    Participant

    Please provide the code, thank you.

    #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);
    
Viewing 4 posts - 1 through 4 (of 4 total)

You need to purchase ‘Front End PM PRO’ to reply in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.