Skip to content

Tag: jquery

Is there an “exists” function for jQuery?

How can I check the existence of an element in jQuery? The current code that I have is this: Is there a more elegant way to approach this? Perhaps a plugin or a function? Answer In JavaScript, everything is ‘truthy’ or ‘falsy’, and for numbers 0 means false, everything else true. So yo…