how can I set #attributes for each item of selectlist I know I can set style for form items with #attributes  but I want set background for select list (drop down) items, how can set #attributes for each item of select list(dropdown) in form_alter ?
function MYTHEME_select($vars) {
  $element = $variables['element'];
  element_set_attributes($element, array('id', 'name', 'size'));
  _form_set_class($element, array('form-select'));

  return '&lt;select' . drupal_attributes($element['#attributes']) . '&gt;' . MYTHEME_form_select_options($element) . '&lt;/select&gt;';
}


function MYTHEME_form_select_options($element) {
  // Build up your own version of form_select_options here
  // that takes into account your extra attribute needs.
  // This will probably involve inspecting your custom FAPI property,
  // which we'll call #extra_option_attributes
}


And your code in the form would be something like:

$form['select'] = array(
  '#type' =&gt; 'select',
  '#options' =&gt; array(1 =&gt; 'One', 2 =&gt; 'Two'),
  '#extra_option_attributes' =&gt; array(
    1 =&gt; array('title' =&gt; 'Test title'), // Attributes for option with key "1",
    2 =&gt; array('title' =&gt; 'Test title'), // Attributes for option with key "2",
  ) 
);


In MYTHEME_form_select_options() you can then inspect the element's #extra_option_attributes key (if one exists) to see if you need to physically add any more attributes in the HTML you create.

Credit to @Clive for this post : https://stackoverflow.com/questions/9261224/adding-attribute-to-option-element-using-forms-api-drupal-7/9264589#9264589 .. Cross posting here in Drupal Q &amp; A