ipbr

Function to add custom mask

Nov 7th, 2018
2,240
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * WordPress Plugin: Masks Form Fields - https://wordpress.org/plugins/masks-form-fields/
  3.  * Function to add custom mask. /wp-content/themes/YOUR-THEME/functions.php
  4.  * Documentation, Demos & Usage Examples - jQuery Mask Plugin v1.14.0 - https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html
  5.  */
  6. function custom_masks_form_fields() {
  7.     ?>
  8.     <script type="text/javascript">
  9.         jQuery(document).ready(function($){
  10.             $("input[name='input_name']").mask('(000) 000-0000');
  11.             // $("input.class_name").mask('custom-mask');
  12.         });
  13.     </script>
  14.     <?php
  15. }
  16.  
  17. add_action('wp_footer', 'custom_masks_form_fields', 111);
RAW Paste Data