Welcome to WebmasterWorld Guest from 54.145.58.37

Forum Moderators: open

Message Too Old, No Replies

What does $(string) mean?

     
4:21 pm on May 7, 2005 (gmt 0)

New User

10+ Year Member

joined:Feb 9, 2005
posts:18
votes: 0


I found the following statement in a JavaScript library module:

var elements = document.getElementsByClassName($('class-name').value);

Would someone please explain the $(string) referrence?

Thank you very much.

Jay

11:10 pm on May 7, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Mar 3, 2004
posts:270
votes: 0


You're probably looking at code that uses Prototype [prototype.conio.net], a javascript library. $() is just a function in the library, not special javascript syntax. In simple usage it works like this:

function $(domID) { 
return document.getElementById(domID);
}

(That's not the actual function definition, it's just a simplification.)

11:20 pm on May 7, 2005 (gmt 0)

New User

10+ Year Member

joined:Feb 9, 2005
posts:18
votes: 0


Thank you very much!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members