1

On my site I load datepicker.min.js

    <script type='text/javascript' src='http://xxx/wp-includes/js/jquery/ui/core.min.js?ver=1.11.4'></script>
    <script type='text/javascript' src='http://xxx/wp-includes/js/jquery/ui/datepicker.min.js?ver=1.11.4'></script>
    <script type='text/javascript'>
jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({"closeText":"Fermer","currentText":"Aujourd\u2019hui","monthNames":["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre"],"monthNamesShort":["Jan","F\u00e9v","Mar","Avr","Mai","Juin","Juil","Ao\u00fbt","Sep","Oct","Nov","D\u00e9c"],"nextText":"Suivant","prevText":"Pr\u00e9c\u00e9dent","dayNames":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"dayNamesShort":["dim","lun","mar","mer","jeu","ven","sam"],"dayNamesMin":["D","L","M","M","J","V","S"],"dateFormat":"MM d, yy","firstDay":1,"isRTL":false});});
</script>

So I wish to add a datepicker to my input

<input type="text" class="mkdf-filter-min-date" name="min_date" placeholder="Check-in:" value="<?php echo esc_attr( $today ) ?>"/>

But i don't find how to do.

  • you have to add JavaScript to bind the input tag to the datepicker : jqueryui.com/datepicker – Kaperto Dec 2 '19 at 14:00
  • and how do you do this ? – Gregory Dec 2 '19 at 14:01
  • i found my solution, thank you – Gregory Dec 2 '19 at 14:07
0

ok, i got it, i was adding it to input name & not input class !

<script type="text/javascript">
jQuery(document).ready(function($) {
    $('.mkdf-filter-min-date').datepicker({
        dateFormat : 'yy-mm-dd'
    });
});
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.