By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

What is '$(elementname)'

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a

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

P: n/a
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.