[jQuery] Re: Dealing with Non existent nodes

2007-06-17 Thread Scottus
thanks this worked well. I guess the key the if statement is testing for truth of a statement that anything that makes it false counts as false even if its non existence. o = document.getElementsByTagName('title')[0]) && nice code. thanks On 6/17/07, RobG <[EMAIL PROTECTED]> wrote: On Jun

[jQuery] Re: Dealing with Non existent nodes

2007-06-16 Thread RobG
On Jun 17, 4:06 pm, RobG <[EMAIL PROTECTED]> wrote: [...] > alert('The document title is: ' + o.title); Of course that should be o.text -- Rob

[jQuery] Re: Dealing with Non existent nodes

2007-06-16 Thread RobG
On Jun 17, 2:52 pm, "Scottus " <[EMAIL PROTECTED]> wrote: > I am using > > var title = document.getElementsByTagName('title').item(0).innerHTML; > > to get the content of a pages title tag. > > But if the page has no title tag I get > > "Error: document.getElementsByTagName("title").item(0) has n

[jQuery] Re: Dealing with Non existent nodes

2007-06-16 Thread Christopher Jordan
Why wouldn't you use something like this: $("title").val(); Chris Scottus wrote: I am using var title = document.getElementsByTagName('title').item(0).innerHTML; to get the content of a pages title tag. But if the page has no title tag I get "Error: document.getElementsByTagName("title")