I need to see if an object is present on the page by its selector.
This WOULD normally do it:
startpageentry = $('#' + startpageid)
But that doesn’t return anything. I need a boolean I can put into an if statement like this:
if (startpageentry != ‘false’) {}
How can I do this?
There is no boolean for that because it would prevent from chaining.
You could use
$(something).length>0.But if you need to run in over and over again, I made a little jQuery plugin which is called
doesExist()The usage of it would be