The theme_jquery_colorpicker() function generates an id with a random number. What is the use of this? I cant use it for CSS or target it with jquery as it changes page to page. There might as well be no id at all.
In my case I have 2 color pickers in the same form and I need to target them to listen to the change event, but being that the id changes, I can't target them.
In my case I changed
this:
$element['#id'] = isset($element['#id']) ? $element['#id'] : 'edit-' . rand(0, 9999);
to this:
$element['#id'] = isset($element['#id']) ? $element['#id'] : 'edit-' . drupal_html_class($element['#title']);
Though what I did above assumes each colorpicker form element will have a unique title.
Comments
Comment #1
plopescHello
Random ID's have been removed, now are generated based on parents array, as in default form elements. Current implementation is:
Thank you and sorry for the late response.