Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yellowberri-snippets/10397117 to your computer and use it in GitHub Desktop.
Save yellowberri-snippets/10397117 to your computer and use it in GitHub Desktop.
JS: Toggle Class on Focus Change
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