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
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 Hasan
    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 Hasan
    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 create topic in this support forum.

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