Skip to content

Instantly share code, notes, and snippets.

@chillbits-legacy
Created November 23, 2016 05:23
Show Gist options
  • Save chillbits-legacy/38e0568b6c2171dc16df231eb6b2c30a to your computer and use it in GitHub Desktop.
Save chillbits-legacy/38e0568b6c2171dc16df231eb6b2c30a to your computer and use it in GitHub Desktop.
Detect & add class for your dropdown select element before & after chosen value.
function colorizeSelect(){
if($(this).val() == "0") $(this).addClass("empty");
else $(this).removeClass("empty")
}
$("select").on('change keyup', colorizeSelect).change();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment