Skip to content

Instantly share code, notes, and snippets.

@isramv
Last active June 14, 2022 23:37
Show Gist options
  • Save isramv/04c23e47e0a7eaef3d94 to your computer and use it in GitHub Desktop.
Save isramv/04c23e47e0a7eaef3d94 to your computer and use it in GitHub Desktop.
Check if input has a value add and remove class jQuery
$('input#edit-keys-1').blur(function(){
tmpval = $(this).val();
if(tmpval == '') {
$(this).addClass('empty');
$(this).removeClass('not-empty');
} else {
$(this).addClass('not-empty');
$(this).removeClass('empty');
}
});
@Eswarkumarkantheti
Copy link

Thank you, Very Nice!

@mohinurzokirova
Copy link

Thank you a lot :-)

@imGrappa
Copy link

Thx so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment