Loading JS in plugin
-
Hello,
I try adding a JS file for a plugin settings page.
The setting page works, and when i adding the JS code directly in the settings-page function, then the JS works.
But when adding the JS-code in a file, it doesn’t work:
plugin-name/js/hk-color.jsNow trying with this function, loading the JS file:
... function hk_scripts() { // adding my scripts wp_enqueue_script( 'hk-color', plugins_url( '/js/hk-color.js', __FILE__ )); } add_action( 'wp_enqueue_scripts', 'hk_scripts' ); ...But the script hk-color.js doesn’t load.
How can loading een js-script needed for my plugin?
PS: I try implement this color picker, and follow the tutorial: http://www.wordpresscheatsheets.com/how-to-add-wordpress-color-picker
Christophe
The topic ‘Loading JS in plugin’ is closed to new replies.