469,366 Members | 2,407 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

What is '$(elementname)'

Can anyone explain to me what the $(.......) means??

ClassName.prototype = {
initialize : function(element1, element2) {
this.element = $(element1);
this.container = $(element2);
}

Thanks in advance

Aug 25 '06 #1
3 1089
gl******@hotmail.com wrote:
Can anyone explain to me what the $(.......) means??

ClassName.prototype = {
initialize : function(element1, element2) {
this.element = $(element1);
this.container = $(element2);
}
It is a call to an obscurely (and poorly) named function. The function
must be defined somewhere in code or calls to it will error out, and
that functi9on definition will determine what the function actually
does. There is a convention in ECMA 262 (the specification for the
standardised code or javascript) that Identifiers beginning with the -
$ - are intended to indicate that they are machine generated, but
authors who arre not familiar with the language often act in ignorance
of that.

Richard.
Aug 25 '06 #2

gl******@hotmail.com wrote:
Can anyone explain to me what the $(.......) means??

ClassName.prototype = {
initialize : function(element1, element2) {
this.element = $(element1);
this.container = $(element2);
}

Thanks in advance
It could be the shorthand re-implementation of getElementById(). Thats
the only time i've ever seen a function named $.

Aug 25 '06 #3
gl******@hotmail.com wrote:
Can anyone explain to me what the $(.......) means??
ClassName.prototype = {
initialize : function(element1, element2) {
this.element = $(element1);
this.container = $(element2);
}
As Richard C. and Richard L. has already said, it's a function, and it
seems like it in this case is a shorthand for document.getElementById().
There is a library called prototype.js that defines a function $() which
behaves like this, so my guess is that your code requires prototype.js
or some other library built on, or inspired by, it.

--
Trond Michelsen
Aug 25 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.