Fork me on GitHub

Also checkout the Select List Form Element to use this widget on a form.

Select List

Render Array

var content = {};
content['my_select_list'] = {
  theme: 'select',
  options: {
    0: 'No',
    1: 'Yes',
    2: 'Maybe So'
  },
  value: 2
};

theme('select', ...)

var html = theme('select', {
  options: {
    0: 'No',
    1: 'Yes'
  }
});

jQuery Mobile Selectmenu Widget Option Text Align Left

Use CSS like this to align the option text for a field on the node edit form:

#node_edit .field-name-field-my-field .ui-select .ui-btn {
  text-align: left;
}