DatePicker Object has no method datepicker on WordPress and Gravity Forms

DatePicker Object has no method datepicker on WordPress and Gravity Forms

I recently designed a website using WordPress and the Paradise Hotel theme but when it came to creating the reservations form, datepicker would not work with either Contact Form 7, we immediately tried Gravity Forms but still no dice, when we checked we were getting a JavaScript error:

DatePicker – TypeError: Object [object Object] has no method ‘datepicker’

We contacted Gravity Forms and they asked us to see if the problem occurred with one of the pre-installed themes – it did not – they then used this reasoning to immediately wash their hands of us, touting an issue with the theme so we would have to contact the theme support.

The file being referenced in the error was the Gravity Forms datepicker initialisation script at wp-contentpluginsgravityformsjsdatepicker.js which contained the following:


function gformInitDatepicker(){

function (){
var element = jQuery(this);
var format = "mm/dd/yy";

format = "mm/dd/yy";
else if(element.hasClass("dmy"))
format = "dd/mm/yy";
else if(element.hasClass("dmy_dash"))
format = "dd-mm-yy";
else if(element.hasClass("dmy_dot"))
format = "";
else if(element.hasClass("ymd_slash"))
format = "yy/mm/dd";
else if(element.hasClass("ymd_dash"))
format = "yy-mm-dd";
else if(element.hasClass("ymd_dot"))
format = "";

var image = "";
var showOn = "focus";
showOn = "both";
image = jQuery('#gforms_calendar_icon_' +;

element.datepicker({ yearRange: '-100:+20', showOn: showOn, buttonImage: image, buttonImageOnly: true, dateFormat: format, changeMonth: true, changeYear: true });

Looking at it, it’s simply a pimped initialization script so we replaced it with something much simpler:

jQuery(document).ready(function($) {
$( ".datepicker" ).datepicker({ dateFormat: 'dd-M-yy' });

And hey presto, we’re back in business.

To my mind this makes indicates this is an issue with Gravity Forms but there you go, hopefully this will help someone else.

Bob McKay

About Bob McKay

Bob is a Founder of Seguro Ltd, a full time father and husband, part-time tinkerer-with-wires, coder, Muay Thai practitioner, builder and cook. Big fan of equality, tolerance and co-existence.

Disclosure Policy

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.