Hide Datepicker on Manual Input

Hide the datepicker if the user begins to manually enter a date via the Datepicker’s associated input.

Instructions

  1. Install this snippet with our free Custom JavaScript plugin. https://gravitywiz.com/gravity-forms-code-chest/

Code

Filename: gpld-hide-datepicker-on-manual-input.js

/**
 * Gravity Perks // Limit Dates // Hide Datepicker on Manual Input
 * https://gravitywiz.com/documentation/gravity-forms-limit-dates/
 *
 * Hide the datepicker if the user begins to manually enter a date via the Datepicker's associated input.
 *
 * Instructions:
 *
 * 1. Install this snippet with our free Custom JavaScript plugin.
 *    https://gravitywiz.com/gravity-forms-code-chest/
 */
$( '.datepicker' ).on( 'keypress', function() {
	$( this ).datepicker( 'hide' );
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.