0

I currently have a contact form on my WordPress site. I have date and time inputs, for the date input I'm currently using the "jquery-ui-datepicker" and have it working in the following setup.

In my functions.php

wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');

and in my form.php I'm applying the jQuery to my form

<fieldset class="usp-date">
<label for="user-submitted-date"><?php _e('Date of News'); ?></label>
<input name="user-submitted-date" type="text" value="" placeholder="<?php _e('7/4/12'); ?>" required="required" id="MyDate">
</fieldset>

The jQuery

jQuery(document).ready(function() {
jQuery('#MyDate').datepicker({
    dateFormat : 'm-d-y' ,
    minDate: 0
});
});

</script>

What the best way to apply http://plugins.jquery.com/jt.timepicker/ to my time fieldset

<fieldset class="usp-starttime">
<label for="user-submitted-starttime"><?php _e('Start Time'); ?></label>
<input name="user-submitted-starttime" type="text" value="" placeholder="<?php _e('11:00 am'); ?>">
</fieldset>

Download from github, and call the css/js in my functions.php? Then I'm unsure how to call the jQuery in my form.php

  • Have you read this question? – fuxia Jul 27 '13 at 11:12
  • I did, as that answer has stated jQuery UI Datepicker is bundled with Wordpress, and I have that working. A jquery/ui TIMEPICKER is not. That's were I'm having trouble correctly using the wp_enqueue_script method. – Mills Jul 31 '13 at 17:25

Your Answer

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

Browse other questions tagged or ask your own question.