Created
April 10, 2014 15:59
-
-
Save yellowberri-snippets/10397117 to your computer and use it in GitHub Desktop.
JS: Toggle Class on Focus Change
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
var elementWrapper = $('#element-wrapper-id'); | |
var element = $('#element-id'); | |
element.on('focus', function() { | |
classSwap('class-one', 'class-two', elementWrapper); | |
}); | |
element.on('focusout', function() { | |
classSwap('class-one', 'class-two', elementWrapper); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment