Add `datetimepicker` to form
I have a form where i would like to add a datetimepicker()
.
I must be doing something wrong.
I have done the following:
In my header.php
?php wp_enqueue_script("jquery"); ?
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');
In my template.php
form id="" name="" action="?php echo get_permalink(); ?" method="post"
input type="text" id="MyDate" name="MyDate" value=""/
input type="submit" value="Submit" name="submit"
/form
script type="text/javascript"
jQuery(document).ready(function() {
jQuery('#MyDate').datepicker({
dateFormat : 'dd-mm-yy'
});
});
/script
Here is the error:
Uncaught TypeError: jQuery(...).datepicker is not a function
I see the input
element but if I click in it nothing happens.
This all comes from the following link
Hope anyone sees my mistake(s)!
M.
Topic datepicker wp-enqueue-style wp-enqueue-script jquery Wordpress
Category Web