Last active
July 25, 2016 21:03
-
-
Save sendgrid-gists/bf2a58e06cc96cb209cc3f219e702f81 to your computer and use it in GitHub Desktop.
SendGrid style-guide required select
This file contains hidden or 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 is-required"> | |
<label class="input-select-label" for="select-example-required">State</label> | |
<div class="input-select"> | |
<select id="select-example-required"> | |
<option selected="true">Select a state</option> | |
<option value="AZ">Arizona</option> | |
<option value="CO">Colorado</option> | |
<option value="ID">Idaho</option> | |
<option value="MT">Montana</option> | |
<option value="NE">Nebraska</option> | |
<option value="NM">New Mexico</option> | |
<option value="ND">North Dakota</option> | |
<option value="UT">Utah</option> | |
<option value="WY">Wyoming</option> | |
</select> | |
</div> | |
</div> |
This file contains hidden or 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
$(function() { | |
$("#select-example-required").on('blur', function() { | |
$(this).parent().removeClass("is-focused"); // add is-focused on .input-select | |
}).on('focus', function() { | |
$(this).parent().addClass("is-focused"); // remove is-focused on .input-select | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment