Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Check if an element exists in the DOM
- From: simone at tomato.it (Simone Fumagalli)
- Subject: [Javascript] Check if an element exists in the DOM
- Date: Wed Oct 18 07:57:00 2006
Hello.
How do I check if an element with id="XYZ" is present in my page/DOM ?
I've tried with:
if ($('XYZ') == undefined) {
// Do something
} else {
// Do something else
}
but, of course, javascript give me an error of undefined object.
Ideas ?
Simone
- Follow-Ups:
- [Javascript] Check if an element exists in the DOM
- From: David Dorward
- [Javascript] Check if an element exists in the DOM
- From: John Deighan
- [Javascript] Check if an element exists in the DOM
- Prev by Date: [Javascript] Avoid multiple onclick
- Next by Date: [Javascript] Check if an element exists in the DOM
- Previous by thread: [Javascript] Avoid multiple onclick
- Next by thread: [Javascript] Check if an element exists in the DOM
- Index(es):