Created
March 12, 2013 09:03
-
-
Save thetekst/5141317 to your computer and use it in GitHub Desktop.
jQuery function exists HTML-element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// write jQuery function | |
jQuery.fn.exists = function() { | |
return $(this).length; | |
} | |
// use the function | |
// if not exists run the getPreloader() | |
if(!$("#loader").exists()){ | |
getPreloader(); | |
} | |
// if exists remove tag | |
if($("#loader").exists()){ | |
jQuery("#loader").remove() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment