Skip to content

Instantly share code, notes, and snippets.

@vdite
Last active August 29, 2015 13:58
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 vdite/9934467 to your computer and use it in GitHub Desktop.
Save vdite/9934467 to your computer and use it in GitHub Desktop.
if/else Kurzschreibweise in JavaScript
/** normale lange Schreibweise **/
if(omv){
$('select option[value="x"]').remove();
}else{
$('select option[value="x"]').attr('disabled','disabled');
}
/** wesentlich kürzere Schreibweise **/
omv ? $('select option[value="x"]').remove() : $('select option[value="x"]').attr('disabled','disabled');
@vdite
Copy link
Author

vdite commented Apr 2, 2014

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