Last active
July 25, 2016 21:02
-
-
Save sendgrid-gists/ec2d7cfba8fbb04cd914ce990c674c60 to your computer and use it in GitHub Desktop.
SendGrid style-guide error 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 is-error"> | |
<label class="input-select-label" for="select-example-error">State</label> | |
<div class="input-select"> | |
<select id="select-example-error"> | |
<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> | |
<span class="input-info danger">State is a required field.</span> | |
</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-error").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