bp_core_add_jquery_mask_inline_js()

Prints script to add input mask to all telephone fields.

Description

Source

File: bp-core/bp-core-cssjs.php

function bp_core_add_jquery_mask_inline_js () {
    ?>

    <script>
        jQuery(document).ready(function(){
            jQuery(".field_type_telephone").each(function(){
                var $this = jQuery(this),
                    field_id = $this.find('.input_mask_details').data('field_id'),
                    pmask = $this.find('.input_mask_details').data('val');

                if ( field_id && pmask ) {
                    jQuery( '#' + field_id ).mask( pmask ).bind('keypress', function(e){if(e.which == 13){jQuery(this).blur();} } );
                }
            });
        });
    </script>

    <?php
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.