// Provide an Account Handle input mask to receive Twitter and Instagram account handles
add_filter( 'gform_input_masks', function( $masks ) {
$masks['Account Handle'] = '@*?**************************';
return $masks;
} );
add_filter( 'gform_input_mask_script', function( $script, $form_id, $field_id, $mask ) {
if ( $mask == '@*?**************************' ) {
$script = "jQuery.mask.definitions['*'] = '[A-Z,a-z,0-9,_]'; jQuery('#input_{$form_id}_{$field_id}').mask('" . esc_js( $mask ) . "',{placeholder:' '}).on('keypress', function(e){if(e.which == 13){jQuery(this).blur();}});";
}
return $script;
}, 10, 4 );
#