Skip to content

Instantly share code, notes, and snippets.

@shaunwallace
Last active December 16, 2015 17:19
Show Gist options
  • Select an option

  • Save shaunwallace/5469500 to your computer and use it in GitHub Desktop.

Select an option

Save shaunwallace/5469500 to your computer and use it in GitHub Desktop.
function hideElement( elem, target ) {
//wrap as jquery object if it isnt one
elem = elem instanceof jQuery ? elem : $( elem );
//if there is a target and that target is a function then run that function
//and return the elem to hide otherwise simply hide the element
target ? typeof( target ) === 'function' ? ( target(elem) ).hide() : elem.find( target ).hide() : elem.hide();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment