multiple search dropdowns code example

Example 1: semantic ui dropdown value

handleDropDownSelect = (event, data) => {
   console.log(data.value);
  };
  
  <Dropdown
          className="ui primary"
          onChange={this.handleDropDownSelect}         
          options={this.props.DropDownValues}
        />

Example 2: search in dropdown

function formatState (state) {
  if (!state.id) {
    return state.text;
  }
  var baseUrl = "/user/pages/images/flags";
  var $state = $(
    '<span><img src="' + baseUrl + '/' + state.element.value.toLowerCase() + '.png" class="img-flag" /> ' + state.text + '</span>'
  );
  return $state;
};

$(".js-example-templating").select2({
  templateResult: formatState
});

Tags:

Misc Example