I want JQuery Colorpicker to appear in a form in a Flat mode - allow my site users pick a color of choice.

So I did the following:
a. installed JQuery Colorpicker field
b. created a new custom module - to load a new form
c. In the form - created a color picker like this:

$form['element'] = array(
'#type' => 'jquery_colorpicker',
'#title' => t('Color'),
'#default_value' => 'FFFFFF',
);

d. Bingo! - the color picker appears as a button - and NOT as a flat mode.

e. Looking at sample code from when I make a dummy HTML file with following code, the plugin works perfectly:

$(document).ready(function() { $('#picker').ColorPicker({ flat:true, layout:'hex', submit:0 }); } )

f. I tried the following without success:
1. Added a .js file to my module's .info file
2. Tried drupal_add_js() to include the file from my module
3. Added the script to my page.tpl.php

None of above has been successful - please help!

Thanks in advance!

Comments

VM’s picture

my untrained eye picks up the following from: https://www.drupal.org/node/171213

The .ready() function also has the ability to alias the jQuery object:

jQuery(document).ready(function($) {
  // Code that uses jQuery's $ can follow here.
});

your .ready() function doesn't seem to match.

citricguy’s picture

Did you ever find a solution for this?