Interactive
Interactive

Reputation: 1550

WordPress datepicker doesn't show

I have the datepicker(); enqueued but it doesn't show.
The funny thing is that if I press Enter after I clicked the input-field the date shows up.

Can anyone please help me? This is the script im my template file from WordPress:

<div class="content">
        <?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');
        ?>
        <input type="text" id="MyDate" name="MyDate" value=""/>
        <script>
        jQuery(document).ready(function() {
            jQuery('#MyDate').datepicker({
                dateFormat : 'dd-mm-yy'
            });
        });
        </script>
    </div>

Upvotes: 0

Views: 748

Answers (2)

Marco Marsala
Marco Marsala

Reputation: 2462

Try to add to your CSS

.ui-datepicker[style] { z-index: 999999 !important }

don't miss the [style] part, it is not a typo but the CSS syntax to override inline styles from a stylesheet file

Upvotes: 1

Domain
Domain

Reputation: 11808

This could mean that your DatePicker element ( or its encapsulating element) is not being displayed but has been created and rendered by the jQuery DatePicker library, and it could be the result of a CSS rule of "display:none;" being set to one of the elements of the DatePicker.

So your code is working but not being displayed. Please search in the CSS for the rule that is responsible for this and then for it you can give a specific CSS in your theme to make it visible.

Upvotes: 1

Related Questions