jQuery, datePicker widget - Display disabled date in datePicker text box -



jQuery, datePicker widget - Display disabled date in datePicker text box -

jquery 1.7.2, jquery ui datepicker widget

in datepicker: today , future dates enabled previous dates disabled

i have situation, need display old date in text box when image clicked popup should have dates enabled today. if old date 1jun2014, today getting displayed in text box. how can display 1jun2014 in text box , in popup dates enabled today?

javascript:

<script type="text/javascript"> $(function() { $('#date-picker').datepicker({ showon: "button", mindate: 0, maxdate: "+11m", dateformat:"d m y", altfield: "#alternate", altformat: "yymmdd" }); var dispdate = $.datepicker.parsedate('yy-mm-dd', '2014-06-01'); //$('#date-picker').datepicker('setdate', dispdate); /* updated code - begins */ var newdate = $.datepicker.formatdate("yymmdd", dispdate); var newdispdate = $.datepicker.formatdate("d m y", dispdate); $('#date-picker').val(newdispdate); $('#alternate').val(newdate); /* updated code - ends */ }); </script>

html:

<input type="text" name="startdate" id="date-picker" size="10" readonly="readonly"/> <input type="hidden" name="altdate" id="alternate"/>

update: based on yashman gupta's reply updated code, works expected.

check link below. textbox takes default value date , when click on textbox, start today's date. hope work you.

$(function () { var currentdate = new date(); $("#datepicker").datepicker({ mindate: currentdate, maxdate: "+1m +10d" }); }); <p>date: <input type="text" id="datepicker" value="06/05/2014"> </p>

http://jsfiddle.net/yashmangupta/p8j6d/1/

jquery jquery-ui-datepicker

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -