Jump to content

How to search for an id


freelance84

Recommended Posts

Ok i know i must be something wrong here but i can't see it. I want to check if an id exists before carrying out an action. Here's my if statement:

 

    if (document.getElementById("hiddenValues"))

 

The script isn't working if the id isn't on the page.

 

I take it this isn't the correct way to determine if an element exists... what is?

 

(ie simply says "Object Required")

Link to comment
https://forums.phpfreaks.com/topic/228005-how-to-search-for-an-id/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.