Colorbox ajax + colorpicker插件

I'm currently making a form which is opened via colorbox's ajax feature. On my form i would like to make one of the input fields react on a jquery plugin (colorpicker), but it wont apply to the input field. I've tried to apply the script ( on the main page (where i load the ajax colorbox), and on the page that i get by ajax, but without luck.

The only thing i have to do in the plugin, is to load the js file and set the input's id="color". It isn't working as intended.

I've searched google dry for a solution to this problem.

Hope anybody has a solution to this problem!

UPDATE:

I use this in my headtag to initialize the jquery plugin (ColorPicker)

<script type="text/javascript" src="jscolor.js"></script>

This is the function i call on Colorbox

jQuery(".ajax").colorbox({onComplete:function(){}});

The button where i execute the ajax function

<a class="ajax cboxElement" title="Settings for '.$load_all_polls->poll_title.'" href="edit.php?poll_id='.$load_all_polls->poll_id.'">Indstillinger</a>

Button with ajax call works fine!

And the inputfield which ColorPicker should respond to (inside the ajax call)

<input class="color" value="<?php echo $poll->bg_color; ?>" name="bg_color">

Again, the problem is that ColorPicker loads through my (DOM tree?) before the Ajax is called, therefore ColorPicker wont recognize the inputfield in the ajax call.

What to do ? :)

Regards, Mathias

The input field is loaded after page load via ajax. So colorpicker can not able to bind event to this newly loaded element. You should use delegate for attaching event to input field.