Skip to content

Instantly share code, notes, and snippets.

@sendgrid-gists
Last active December 15, 2016 17:54
Show Gist options
  • Save sendgrid-gists/61fd9000169608ec222c2b4fed266d2d to your computer and use it in GitHub Desktop.
Save sendgrid-gists/61fd9000169608ec222c2b4fed266d2d to your computer and use it in GitHub Desktop.
SendGrid style-guide select2
<div class="input-select-wrap">
<label class="input-select-label" for="select2-example-default">Sender</label>
<select id="select2-example-default">
<option></option>
<option value="Jason">Jason</option>
<option value="Evan">Evan</option>
<option value="Katrina">Katrina</option>
</select>
</div>
$("#select2-example-default").select2({
width: "100%", // sets inline width to 100%
minimumResultsForSearch: Infinity, // disables search
placeholder: "Select a sender", // show a placeholder
}).focus(function() {
$(this).select2("open"); // extend select2 to open on label focus
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment