Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 32 additions & 31 deletions public/javascript/zebra_datepicker.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -1377,35 +1377,6 @@

e.preventDefault();

// clear the element's value
$element.val('');

// if date picker is not always visible
if (!plugin.settings.always_visible) {

// reset these values
default_day = null; default_month = null; default_year = null; selected_month = null; selected_year = null;

// if date picker is always visible
} else {

// reset these values
default_day = null; default_month = null; default_year = null;

// remove the "selected" class from all cells that have it
$('td.dp_selected', datepicker).removeClass('dp_selected');

}

// hide the date picker
plugin.hide();

// if a callback function exists for when clearing a date
if (plugin.settings.onClear && typeof plugin.settings.onClear == 'function')

// execute the callback function and pass as argument the element the plugin is attached to
plugin.settings.onClear.call($element, $element);

});

// if date picker is not always visible
Expand Down Expand Up @@ -1451,9 +1422,39 @@
*
* @return void
*/
plugin.clear_date = function() {
plugin.clear_date = function(fireEvent) {

// clear the element's value
$element.val('');

$(cleardate).trigger('click');
// if date picker is not always visible
if (!plugin.settings.always_visible) {

// reset these values
default_day = null; default_month = null; default_year = null; selected_month = null; selected_year = null;

// if date picker is always visible
} else {

// reset these values
default_day = null; default_month = null; default_year = null;

// remove the "selected" class from all cells that have it
$('td.dp_selected', datepicker).removeClass('dp_selected');

}

// hide the date picker
plugin.hide();

//check whether event should be fired, default: true
if (fireEvent === undefined || fireEvent === null || fireEvent === true)

// if a callback function exists for when clearing a date
if (plugin.settings.onClear && typeof plugin.settings.onClear == 'function')

// execute the callback function and pass as argument the element the plugin is attached to
plugin.settings.onClear.call($element, $element);

};

Expand Down