mujas mujas - 1 year ago 138
jQuery Question

How to select current day when user was in other months in Datepicker calender by using a clickable button.?

I have an event calender in my magento website.
I need to redirect users to current date while they are in other months.
I have a button called TODAY to write the click event.

EX : now I am in month of march, I want to go to February by clicking the button TODAY.
Please see the image I will post here.

I am unable to publish an image, if any one nee an image for this I can send it to you.
Great pleasure if any one can help me on this. Thank you.

<link rel="stylesheet" href="">

<script src=""></script>

jQuery(function() {

var jqdpopup = jQuery('#event_popup').dialog({autoOpen: false});
var myDate = new Date();
var prettyDate =(myDate.getMonth()+1) + '/' + myDate.getDate() + '/' +

jQuery('.eventslisting_title span').html(prettyDate);
var datesArray=["11/02/2014","11/03/2014"];


inline: true,
beforeShowDay: function (date) {
var theday = (date.getMonth()+1) +'/'+
date.getDate()+ '/' +
return [true,jQuery.inArray(theday, datesArray) >=0?"eventDate":''];
onSelect: function(date, obj){
jQuery('#date_input').val(date); //Updates value of of your input
jQuery('.eventslisting_title span').html(date);
jqdpopup.dialog( "open" );


Answer Source

Check out the setDate method in the datepicker api:

To set the date by clicking a button do this:

    jQuery('#event_calender').datepicker( "setDate",  "today");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download