jQuery on a custom plugin page
-
Hi, I’m trying to add a jQuery datepicker on my plugins page, but it gives a strange error:
d(a).zIndex is not a function jquery.ui.datepicker.min.js?ver=3.0.1 Line 37And it only appears when the datepicker is set to an input field. If the datepicker is inline – i.e. targeting a <div> there is no problem and it appears and works fine.
Here’s how it’s included:
add_action('admin_print_scripts', 'hnr_load_scripts'); add_action('admin_print_styles', 'hnr_load_styles'); function hnr_load_styles() { wp_enqueue_style('jquery.ui.theme', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'ui-lightness/jquery-ui-1.8.5.custom.css'); } function hnr_load_scripts() { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-datepicker', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'jquery.ui.datepicker.min.js', array('jquery','jquery-ui-core')); }<script> jQuery(document).ready(function() { jQuery(".dp1").datepicker(); jQuery(".dp2").datepicker(); }); </script><input type="text" name="dp1" value="" class="dp1" /> <div class="dp2"></div>the dp1 is the buggy one. dp2 is displaying and working fine.
Anyone have an idea why this is happening and how to fix it?
The topic ‘jQuery on a custom plugin page’ is closed to new replies.