Created
April 18, 2022 12:11
-
-
Save adczk/18443734ebcda8165888130c4298d9d9 to your computer and use it in GitHub Desktop.
Forminator - prevent field cut, copy, paste
This file contains hidden or 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
| <?php | |
| /************************* | |
| * | |
| * Forminator - prevent cut/copy/paste in fields | |
| * | |
| * adjust fields CSS IDs in code if needed | |
| * | |
| * by adamcz/WPMU DEV | |
| * | |
| * tested with Forminato 1.15.12 | |
| * | |
| * use as MU plugin | |
| * | |
| **************************/ | |
| add_action( 'wp_footer', 'my_form_prevent_paste', 99 ); | |
| function my_form_prevent_paste() { | |
| ob_start(); | |
| ?> | |
| <script> | |
| ( function( $ ) { | |
| $( document ).ready( function() { | |
| $( '#forminator-field-email-1' ).on( 'cut copy paste', function( e ) { | |
| e.preventDefault(); | |
| }); | |
| $( '#forminator-field-email-2' ).on( 'cut copy paste', function( e ) { | |
| e.preventDefault(); | |
| }); | |
| }); | |
| } ( jQuery ) ); | |
| </script> | |
| <?php | |
| $scripts = ob_get_clean(); | |
| echo $scripts; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment