Skip to content

Instantly share code, notes, and snippets.

@royboy789
Created November 2, 2016 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royboy789/a0a3833fa0a7505ed63f9ae1b4ac56c2 to your computer and use it in GitHub Desktop.
Save royboy789/a0a3833fa0a7505ed63f9ae1b4ac56c2 to your computer and use it in GitHub Desktop.
toggle class if input has value
$('.input-class').on('change', function(){
if( $(this).val().length > 0 ) {
$(this).toggleClass('value');
} else if($(this).val().length < 1 ) {
$(this).toggleClass('value');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment