[thelist] DOM question

Tom Dell'Aringa pixelmech at yahoo.com
Thu Mar 3 14:39:49 CST 2005


I'm racking my brains on this because I've forgotten everything I knew it seems. Anyway, I have a
particular A object reference from a link being clicked. I want to get the *actual link text* of
the anchor (not the href).

So if this is my example:

<li><a href="#" onclick="return ChooseItem(this);">Item one</a></li>

Forget about the implementation right now, this is test code. I need to get the text "Item one" in
my ChooseItem() function.

I figure I need to crawl down the childNodes, but I can't seem to get it.

function ChooseItem(choice) {
  var myLinkText = choice.(some DOM call here)
}

Since i already have the object, seems like it should be easy but can't quite get it.

Tom


http://www.pixelmech.com/

Melissa: Ace, Where are you?
Ace Ventura: I'm in Psychoville and Finkle's the Mayor.



More information about the thelist mailing list