javascript - Combining jQuery datepicker functions -
i have 2 functions i'd use narrow down selection in jquery datepicker. i'm stuck on how combine these 2 functions can use them in combination each other. right ever 1 put first takes priority , other doesn't work.
//the html <input type="text" class="input-text hasdatepicker" name="order_delivery_date" id="datepicker" placeholder="select date" value=""> //two functions, whichever 1 first works <script type="text/javascript"> jquery(function ($) { $( "#datepicker" ).datepicker({ mindate: "+1", maxdate: "+1m +10d" }); }); jquery(function ($) { $( "#datepicker" ).datepicker({beforeshowday: function(date){ return [date.getday() != 2, '']; }})}); </script> // attempt combine them, not working <script type="text/javascript"> jquery(function ($) { $( "#datepicker" ).datepicker({ mindate: "+1", maxdate: "+1m +10d" }); $( "#datepicker" ).datepicker({beforeshowday: function(date){ return [date.getday() != 2, '']; }}); }); </script>
the first line of code creates datepicker object on $('#datepicker')
dom element. should pass options datepicker in 1 go:
$('#datepicker').datepicker({ mindate: "+1", maxdate: "+1m +10d" , beforeshowday: function(date){ return [date.getday() != 2, '']; }});
Comments
Post a Comment