Sunday, 15 August 2010

How to add some text to jquery datepicker popup calendar -



How to add some text to jquery datepicker popup calendar -

i have 3 datepicker fields in form, , on 1 of them, have mindate set 4.

i add together text (under or next to) calendar popup only, explaining why necessary user.

i don't wish alter of form (this 'after work completed' client requested change.) adding text form isn't alternative destroy spacing.

to summarize: add together couple of lines of text explaining user why can't pick these dates - right on popup calendar - field only.

is possible, or need utilize solution?

this alternative solution go detail @ stackoverflow thread: jquery ui datepicker - add together static text underneath calendar?

essentially can utilize jquery identify 1 datepicker or can show different texts on multiple datepickers on same page. method create info holders next id/class space of each datepicker location. load info content datepicker selected using (this).

example jquery code: jquery text injection selected datepicker calendar this:

$( ".datepicker" ).datepicker().on( "click", function() { var dtxt = $( ).data('dptxt'); $('.ui-datepicker-calendar').after('<span class="middle">'+dtxt+'</>'); });

this neatly inserts message want within bottom of calendar display.

of course, info element contains message specific datepicker this:

<p>date1: <input type="text" class="datepicker" data-dptxt="the text1 display in datepicker" ></p>

see other thread working jsfiddle example: jquery ui datepicker - add together static text underneath calendar?

jquery datepicker

No comments:

Post a Comment