Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

thatposhgirl on "Can't get color picker to work"

$
0
0

I'm trying to use the color picker in an admin menu for my plugin. I've followed the directs exactly as they appear here: http://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/

I've verified that my-script.js is linked on the page and url is correct.

I have this in my plugin's main .php file:

add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
function mw_enqueue_color_picker( $hook_suffix ) {
    // first check that $hook_suffix is appropriate for your admin page
    wp_enqueue_style( 'wp-color-picker' );
    wp_enqueue_script( 'my-script-handle', ECBS_JS_URL . 'my-script.js', array( 'wp-color-picker' ), false, true );
}

This is my-script.js:

var $j = jQuery.noConflict();
jQuery(document).ready(function($j){
    $j('.my-color-field').wpColorPicker();
});

My input tags that I want to use the color picker have the attribute class="my-color-field".

Nothing happens at all. No errors, nothing.

Any advice would be appreciated.


Viewing all articles
Browse latest Browse all 8245

Trending Articles