I have created a widget for wordpress. The form of the widget has some input boxes. Now, I want to add a custom input box which uses a javascript file I downloaded from http://jscolor.com/
Now, the problem is, it is not working. I have registered the javascript file like this in the form function of the WP_Widget class.
require_once('index.php');
add_action('admin_enqueue_scripts', 'pw_load_scripts');
The pw_load_scripts function is in index.php
function pw_load_scripts() {
wp_register_script('custom-js', plugin_dir_url(__FILE__).'scripts/jscolor.js');
wp_enqueue_script('custom-js');
}
After all these, it is not working. What is the correct way to do this task?
My error.log has this error
[Mon Oct 07 21:37:30.591896 2013] [:error] [pid 14853] [client 127.0.0.1:42453] PHP Fatal error: Cannot redeclare _wp_menu_output() (previously declared in /var/www/wordpress/wp-admin/menu-header.php:36) in /var/www/wordpress/wp-admin/menu-header.php on line 36
Thank you