JS for styling a CB Field in the manager

Hi,

I would like to use a dropdown field in a repeater to choose a color from a list (red, yellow, etc). To have a visual aid for the manager users, I would like to have each row from the select list styled with the corresponding color, which is the option value.

I have tried to run the following code from a plugin, but it has no effect, maybe because the MODx on ready is not the correct event. Any ideas?

MODx.on("ready",function() {
$("select#setting-ovl_col1 option").each(function (){
        var ocolor = $(this).val();
        $(this).css("background-color",ocolor);
    });
});

A custom input type in which you run that code on init might be the best approach.