0

I have a a jquery.ui datepicker. I set it up like so:

 SetupDatepicker($(".date-three-field"), {   
        "buttonText": "Calendar",           
 });

Say, I later want to change the text of the button. Based on this SO answer here, I thought I could just do something like:

$("#id").datepicker('destroy');
$("#id").datepicker("option", { buttonText: "test" })

However, the text remains as 'calendar'. What am I doing wrong?

Community
  • 1
  • 1
davy
  • 4,474
  • 10
  • 48
  • 71

2 Answers2

0

You don't need to call destroy. If you just want to change already configured option the second line is enough.

 $("#datepicker").datepicker("option", { buttonText: "test" });

See: http://jsfiddle.net/2op25nfd/

calinaadi
  • 1,466
  • 1
  • 13
  • 22
0

I know this is an old post, but the answer is as follows:

$( ".selector" ).datepicker( "option", "buttonText", "test" );

See https://api.jqueryui.com/datepicker/#option-buttonText for more info.

Surj
  • 1