Yogesh Popat
Yogesh Popat

Reputation: 82

WordPress: Integrate JavaScript in Admin Pannel in edit.php

I am developing a plugin in WordPress and for the same plugin in settings page I want to integrate a jquery in backend on edit.php. I have followed the below method but it is not working

function cs_colorpicker_js() {
 wp_enqueue_script('cs_colorpicker_js',
                   plugin_dir_url(__FILE__).'js/cs_colorpicker.js'
                   );
}

add_action( 'admin_enqueue_scripts', 'cs_colorpicker_js' );    

here is the screenshot of one error that i have found. http://goo.gl/wmgH60

Upvotes: 1

Views: 53

Answers (1)

Rohan Kumar
Rohan Kumar

Reputation: 40639

Use the third variable of Wp_enqueue_script() like,

function cs_colorpicker_js() {
     wp_enqueue_script('cs_colorpicker_js',
                        plugin_dir_url(__FILE__).'js/cs_colorpicker.js',
                        array('jquery') // jquery dependency
     );
}

Upvotes: 2

Related Questions