jquery datepicker dynamic with personal format -
i'd want applhy @ dynamic element datepicker custom format. have tried doesn't work, no error in console:
var arr_month = new array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'); $( "#check-out").datepicker({ dateformat: 'dd/m/yy', monthnamesshort: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], }); $(document).on('focus',".date-input", function(e){ e.preventdefault(); var mydate = new date(new date().gettime() + 48 * 60 * 60 * 1000); var prettydate =(mydate.getdate()) + '/' + (mydate.getmonth()+1); var formatteddate = $.datepicker.formatdate('dd-m', mydate, {monthnamesshort: arr_month}); $(this).val(formatteddate); }); ii put works fine! :
$(document).on('focus',".date-input", function(e){ e.preventdefault(); $(this).datepicker(); }); the code inside document.ready
how can apply custom format dynamic element datepicker?
my guess you're trying show date in field formatted differently see in datepicker.
did try using datepicker's altfield , altformat properties, described here?
you should able specify selector identifying other fields want populate upon datepicker selection , different format them.
Comments
Post a Comment