jquery error
-
Hi all,
How do I correctly load jquery into wordpress admin? I want to use the jquery datepicker for a custom meta box.
I have read article http://codex.wordpress.org/Function_Reference/wp_enqueue_script.
I do know that wordpress loads its own version of wordpress and I want to deregister that so that I can load jquery.ui.datepicker.js, a local file. Also, I am facing this javascript error and I have no idea on how to resolve this. Can’t get datepicker to load and this error is always there. Any advise is appreciated. Thanks.Message: ‘edButtons.length’ is null or not an object
Line: 3
Char: 3963
Code: 0
URI: http://raihanrealestate.jibz.me/wp-admin/load-scripts.php?c=1&load=utils,editor,quicktags&ver=d652578b8499672dc5f8695841c1aa48/function __construct() { add_action("init", array(&$this, "registerMyCustomPostType")); add_action("init", array(&$this, "loadJs")); add_action( "admin_menu", array( &$this, "createCustomFields" ) ); //add_action( 'save_post', array( &$this, 'saveCustomFields' ), 1, 2 ); add_action( "do_meta_boxes", array( &$this, "removeDefaultCustomFields" ), 10, 3 ); } /* Load Javascript files */ function loadJs() { //I want this to load if admin because I need to use datepicker in admin if(is_admin()) { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js', false, '1.4.1', false); wp_enqueue_script( 'jquery' ); //wp_register_script("jquery-ui-datepicker", get_bloginfo("template_directory") . "/js/jquery-ui-1.8.7/jquery.ui.datepicker.js", array("jquery", "jquery-ui-core")); //wp_enqueue_script("jquery-ui-datepicker"); //wp_register_script("realestate", get_bloginfo("template_directory")."/js/realestate.js", array( "jquery-ui-datepicker") ); //wp_enqueue_script("realestate"); } }Regards,
The topic ‘jquery error’ is closed to new replies.