Last active
December 15, 2016 17:53
SendGrid style-guide select2 groups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="input-select-wrap"> | |
<label class="input-select-label" for="select2-example-groups">Senders</label> | |
<select id="select2-example-groups"> | |
<option></option> | |
<optgroup label="Marketing"> | |
<option value="Evan">Evan</option> | |
<option value="Molly">Molly</option> | |
<option value="Dan">Dan</option> | |
</optgroup> | |
<optgroup label="UI/UX"> | |
<option value="Jason">Jason</option> | |
<option value="Katrina">Katrina</option> | |
<option value="Katie">Katie</option> | |
</optgroup> | |
</select> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#select2-example-groups").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