Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

at first i want to tell that i HAVE read the post:

jQuery UI Datepicker not working

already. I followed the instructions, but stll, i cant get it work.

I am using WP 3.3.1 with the standard theme twentyeleven. There are 2 other jQueries running: "jExpand.js" and "sorttable.js" Thats it. very plain.

In the functions i added this:

add_action( 'wp_print_scripts', 'wp33r01_date_picker' );

function wp33r01_date_picker() {
    wp_enqueue_script( 'jquery' );
    wp_enqueue_script('jquery-ui-core');   
    wp_enqueue_script('jquery-ui-datepicker');
    wp_enqueue_style('jquery.ui.theme', get_bloginfo('wpurl') . '/' . '/css/ui-darkness/jquery-ui-1.8.17.custom.css');
}

which generates this in the DOM (footer):

<script src="http://sge.cashier-software.com/js/jExpand.js" type="text/javascript">
<script src="http://sge.cashier-software.com/js/js_script.js" type="text/javascript">
<link id="jquery.ui.theme-css" media="all" type="text/css" href="http://sge.cashier-software.com//css/ui-darkness/jquery-ui-1.8.17.custom.css?ver=3.3.1" rel="stylesheet">
<script src="http://sge.cashier-software.com/wp-includes/js/admin-bar.dev.js?ver=20111130" type="text/javascript">
<script src="http://sge.cashier-software.com/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.8.16" type="text/javascript">
<script src="http://sge.cashier-software.com/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js?ver=1.8.16" type="text/javascript">

Then i have on Document ready these lines:

jQuery(document).ready(function(){

    // $("#atcs tr:odd").addClass("odd");
    jQuery("#atcs tr:not(.odd)").hide();
    jQuery("#atcs tr:first-child").show();

    jQuery("#atcs tr.odd").click(function(){
        $(this).next("tr").toggle('slow');
        $(this).find(".arrow").toggleClass("up");
     });
    jQuery('tr.detail_row').css({'display':'table-row'});

    //$("#atcs").jExpand();    

    jQuery('#date_from').datepicker();

});

And finally, the simple Form in which i wanted the Datepicker to work:

<form method="post" action="<?php echo get_permalink(); ?>">
   <input type="​text" id="​date_from" name="​sge_date_from">
   <input type="submit" name="sge_submit" value="Submit Form"><br>
</form>

But it simply does NOTHING :(

I hope my description works, so might somebody can help.

Many thanks in advance,

Joe

share|improve this question
    
Check your CSS enqueue. This can't be right: "sge.cashier-software.com//css/ui-darkness/jquery-ui-1.8.17.custom.css?ver=3.3.1‌​". I'm pretty sure all jQuery UI widgets need at least some CSS in order to work properly. If you want the includes folder, use includes_url() instead of get_bloginfo('wpurl'). –  tbuteler Feb 12 '12 at 10:58
    
Thanks for the Answer. You are right, the 2 "//" wasnt ok. But that didnt change nothing. And, i do not want the includes folder. The css is in the right folder and the enqueue gets the right file. So, sorry, but still no prgogress :( –  JSS Feb 12 '12 at 11:20
    
check if you have other jQuery in the header .. you might be loading two different versions .. if so - you need to deqeue one . –  user13279 Feb 12 '12 at 14:30

1 Answer 1

CSS needs to be in the head of the document. Use the admin_enqueue_scripts hook instead. Also be sure to only enqueue the scripts and styles on screens where you need them.

share|improve this answer
    
Definitely right, the only and right way. The datepicker works in 3.3.1, I used in the plugin wp maintenance mode. –  bueltge Feb 12 '12 at 22:39
    
@helenhousandi, thanks for your Answer. I changed the css to the header. But still no improvement :( . Ans, why should i use the admin_enqueue_scripts? The datepicker should run in the frontend. I am not a Wp professional so i might understand things wrong. Lucky to see that at least someone got it running already ;) –  JSS Feb 13 '12 at 8:54
    
If this is on the front, then use wp_enqueue_scripts. –  helenhousandi Feb 13 '12 at 15:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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