I am trying to refactor a code source. I am stuck with a problem of recreating Jquery DatePicker.
My DatePicker has already been initialized like below :
$("#datepicker").datepicker({
showOn : "button",
buttonText: "<i id='really' class='myclass'>Show</i>",
dateFormat: 'dd/mm/yy'});
However , the button class - myclass
, I am using that button to refresh the datePicker options.
$(".myclass").click(function(){
//destroy the old datepicker.
$("#datepicker").datepicker("destroy");
//do something probably async here.
doSomething();
//Recreate the same with some other options
$("#datepicker").datepicker({
showOn : "button",
//More options go here. But buttonText remains the same.
buttonText: "<i id='really' class='myclass'>Show</i>",
dateFormat: 'dd/mm/yy'});
});
My datepicker refreshes, however I am not able trigger the same method again, by clicking the "new" datepicker button with same class.
Can someone help me ?
Update : I am using JQuery 1.3.2, can't use anything beyond that, weird constraints.