Sunday, July 4, 2010

jQuery date picker

To have this working,

1. Include the jQuery UI javascript file into your page.

2. Create an input field and assign it a class. For the purposes of this example, I shall name the input field class, "testDatePicker"

2. Have a jQuery.Document.Ready function and within it, apply the following code.

$('.testDatePicker').datepicker({
dateFormat: 'dd/mm/yy',
showOn: 'both',
buttonImage: '/images/buttons/cal.png',
buttonImageOnly: true,
onSelect: function(){
//Insert any form of logic you will have.
//NOTE: it will have to be in the JavaScript syntax
}
});

No comments:

Post a Comment