Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Move focus to next gravity form field after input mask completed
* Move focus to next field after input mask completed
// update the "86" to the ID of your form
add_filter('gform_input_mask_script', 'gwiz_input_mask_focus_next', 10, 4);
function gwiz_input_mask_focus_next($script, $form_id, $field_id, $mask) {
$script = "jQuery('#input_{$form_id}_{$field_id}').mask('{$mask}', " .
"{ completed: function() { jQuery(this).parents('li.gfield').next('li.gfield').find('input').focus(); }}" .
").bind('keypress', function(e){if(e.which == 13){jQuery(this).blur();} } );";
return $script;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.