473,811 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$

what dose a $ do in javascript, i have been given a bit of code and
there are $'s all over the place, can someone explain their uses

Feb 16 '07
49 2413
VK said the following on 2/18/2007 7:14 AM:
On Feb 18, 4:41 am, "Richard Cornford" <Rich...@litote s.demon.co.uk>
>Yes, the situation is that the dollar symbol should mean machine
generated code, but, if abused, might mean anything at all.

Oh, con'on! Don't start this stuff again. One of major problems with
the FAQ before was exactly that it refused to answer to "unproper"
questions.
Are you referring to questions like "How to round a number?" or "How to
create a Vector in JS?" or is it some other question that you have in
mind that has been asked to be added to the FAQ that was an "unproper
question"?
So like "doesn't matter if the question is asked or not, it
simply shouldn't be asked - so cannot be proper answer for unproper
questions". Something like that... Moreover you did not plan to polish
to the endless perfection the same 3-10 years old set of questions, do
you?
You seem to have forgotten the last 4 months or so.
Prototype.js was the first popular after-war library and it set a few
coding standards for all libraries to come, moreover it set some
standards for future DOM specs.
I have to admit I was wrong about you VK. I wondered a lot if you were
actually as dumb as I thought you were but I was wrong. You aren't even
that smart.
A sample of the first is $ identifier used as document.getDoc umentById
shortcut or extension of this method.
Shortcut wrapper functions were used long before Prototype.js was even a
figment of the imagination of the people who wrote that text. But, are
you saying that $ is going to get included as a "shortcut or extension"
of the "document.getDo cumentById" (Can you give me a URL to the
specification that explains how that works?)?
A sample of the second is getElementsByCl assName - an oftenly needed
method simply overlooked by W3C in DOM 1 and now coming in DOM 3.
getElementsByCl assName wasn't included in any potential DOM 3 specs
because it got included in Prototype.js. Far from it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 18 '07 #21
"VK" <sc**********@y ahoo.comwrote:
On Feb 18, 4:41 am, Richard Cornford" wrote:
>Yes, the situation is that the dollar symbol should mean machine
generated code, but, if abused, might mean anything at all.

Oh, con'on! Don't start this stuff again.
What did I start? I did not write the language's specification, and I
have not imposed other meanings upon the use of the dollar symbol (with a
grand total of 9242 non-dollar symbol characters allowed at the front of
an Identifier by ECMA 262 3rd Ed. there is little reason to be using
characters that already have conventional meaning to signify anything
special).
One of major problems with the FAQ before was exactly that it
refused to answer to "unproper" questions. So like "doesn't matter
if the question is asked or not, it simply shouldn't be asked - so
cannot be proper answer for unproper questions". Something like
that... Moreover you did not plan to polish to the endless
perfection the same 3-10 years old set of questions, do you?
The ability to ask a question does not mean that the question can be (or
should be) answered. For example, the question "What is the meaning of
life?", if answered, pre-supposes that life is something that has
meaning. While that question may be as nonsensical as asking "What is the
meaning of gravity?".
Prototype.js was the first ...
<snip>

To date nobody here but the OP has seen the code in question. We don't
know that it has anything to do with Prototype.js, or any other library
mimicking its errors. The actual code may be employing the dollar symbol
in any way at all (it may even be some of your 'code' which uses $ as
property names, and suffixes with $ to suggest 'private'). The bottom
line is that the dollar symbol has no inherent meaning beyond its being a
currency symbol, and its specified conventional meaning has been
disregarded so frequently that assuming that use (in a random, and
probably non-professionally authored script) is not realistic.
A sample of the first is $ identifier used as document.getDoc umentById
shortcut or extension of this method.

A sample of the second is getElementsByCl assName - an oftenly needed
method simply overlooked by W3C in DOM 1 and now coming in DOM 3.
You think the question of the meaning of the dollar symbol should receive
two mutually exclusive answers that each assert it has a specific
meaning? OK, we know you are irrational so that would not necessarily
seem untenable to you.
So start making a virgin of yourself and answer in FAQ what asked.
The question asked was "what dose a $ do in javascript?", and the answer
is that the dollar symbol may form part of an Identifier, or may be a
character in a string literal or a character or symbol in a regular
expression. Saying anything else is not answering the question in terms
of "in javascript", and the question; 'what may the $ symbol used in an
Identifier mean in javascript?' can only receive the answer that it
should (by specification) mean machine generated code, but may mean
literally anything at all by the whim of the programmer using it.

Anything else would be objectively false.

Richard.

Feb 18 '07 #22
VK
On Feb 18, 6:08 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
Are you referring to questions like "How to round a number?" or "How to
create a Vector in JS?" or is it some other question that you have in
mind that has been asked to be added to the FAQ that was an "unproper
question"?
No, I mean questions like "what does $('str') mean, I see it all
around" - and I mean the holly right you and Mr.Cornford are trying to
reserve to answer: "this is unproper use of $ demonstrating the lack
of knowledge of however did this library".
On the bigger scale you are trying to reserve the right to call junk
on any more-or-less widely deployed library using 1999th chunk of
obscure mumbling from ECMAScript 3rd ed.
Respectively I suggested to both of you to shut up and stop pretending
that the language evolution is evolving around anyone of you. 1999 is
was one meaning for $, 2007 it is all another, 2015 it can be
something completely else.
I have to admit I was wrong about you VK. I wondered a lot if you were
actually as dumb as I thought you were but I was wrong. You aren't even
that smart.
Let my IQ doesn't prevent you from a good sleep. The most important
that your self-estimate remains paramount high throughout the years.

Feb 18 '07 #23
VK said the following on 2/18/2007 1:00 PM:
On Feb 18, 6:08 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
>Are you referring to questions like "How to round a number?" or "How to
create a Vector in JS?" or is it some other question that you have in
mind that has been asked to be added to the FAQ that was an "unproper
question"?

No, I mean questions like "what does $('str') mean, I see it all
around" - and I mean the holly right you and Mr.Cornford are trying to
reserve to answer: "this is unproper use of $ demonstrating the lack
of knowledge of however did this library".
"you and Mr. Cornford"? You have an opportunity, right now, to point to
anywhere in this thread where I have even come close to saying anything
even remotely close to what you are accusing me of having written.
Unless you can do that, you are just showing your ignorance again.

There are 4 (this will make #5) posts by me in this thread. Please point
to *anything* I have written/posted with regards to $ being "unproper
use of $". Until you can do that, shut up yourself lest you embarrass
yourself again.
On the bigger scale you are trying to reserve the right to call junk
on any more-or-less widely deployed library using 1999th chunk of
obscure mumbling from ECMAScript 3rd ed.
1) I have not called Prototype junk in quite a while. If people want to
use it, let them. They deserve what they get.
2) With regards to me and ECMAScript, you should search the archives for
my name and ECMAScript and try to find even one - just one - thread
where I suggested anything that ECMA had to say. What you *will* find
are threads where I said I didn't give a flying crap what ECMA had to say.
Respectively I suggested to both of you to shut up and stop pretending
that the language evolution is evolving around anyone of you. 1999 is
was one meaning for $, 2007 it is all another, 2015 it can be
something completely else.
Me? Spouting about the "language evolution"? You must have me confused
with some figment of your imagination. Now, please back up that claim
with regards to me saying that. Or, even coming close.

And you actually wonder why I think you are a bona fide idiot?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 18 '07 #24
In comp.lang.javas cript message <Xn************ ********@194.10 9.133.242>
, Sat, 17 Feb 2007 18:49:05, Evertjan. <ex************ **@interxnl.net >
posted:
>
2B. Regular Expression replace():
$1, $2, ..

$n is used to represent the nth captured submatch, where n is a single
decimal digit from 1 through 9 [or a double from 10 to 99], when $n is
included in the replace string.

Mozilla.org specifies:
$$ Inserts a "$".
$& Inserts the matched substring.
$` Inserts the portion of the string that precedes the matched substring.
$' Inserts the portion of the string that follows the matched substring.
$n or $nn Where n or nn are decimal digits, inserts the nth parenthesized
submatch string, provided the first argument was a RegExp object.
2Bi. As above. Does $0 have a meaning?

2Bii. A reference to the use of RegExp.$1 etc. to refer to the results
of a match, with (IIRC) a statement that it is deprecated, and that ...
can/should be used instead.

That is, of course, if meanings of $ additional to function $ are to be
included, when the list should be complete as it is obviously intended
for code readers.

===
<URL:http://www.merlyn.demo n.co.uk/gravity4.htmcon tains (/inter alia/)
a moderately-refined demonstration of the use of javascript for
producing one-dimensional pixel-accurate graphics. Try the two buttons
in the bluish box (perhaps with 9 instead of 81).

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Delphi 3? Turnpike 6.05
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.bancoems.co m/CompLangPascalD elphiMisc-MiniFAQ.htmclpd mFAQ;
<URL:http://www.borland.com/newsgroups/guide.htmlnews: borland.* Guidelines
Feb 19 '07 #25
In comp.lang.javas cript message <er************ *******@news.de mon.co.uk>
, Sun, 18 Feb 2007 15:17:40, Richard Cornford
<Ri*****@litote s.demon.co.ukpo sted:
>
What did I start? I did not write the language's specification, and I
have not imposed other meanings upon the use of the dollar symbol (with
a grand total of 9242 non-dollar symbol characters allowed at the front
of an Identifier by ECMA 262 3rd Ed. there is little reason to be using
characters that already have conventional meaning to signify anything
special).
Now \u0624 is probably a letter; I'll represent it here by X. X can be
put between ab and cd, and the resulting 5-letter word abXcd works (IE6
textarea, eval) as an identifier.

But try typing, into an "anglo" IE6 control, X = 5 or X == 5 ,
and one gets 5 = X and 5 == X ; the latter will please at least
one of us.

While the use of non-European characters is at most rarely asked here,
and surely does not qualify for a FAQ entry of its own; ISTM that, if a
page on the subject of typing characters from reversed languages (not
necessarily in script identifiers) can be found, it could well be right
to link to it from FAQ 2.10.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Feb 19 '07 #26
Dr J R Stockton wrote:
<snip>
Now \u0624 is probably a letter; ...
<snip>

According to my reference it is "Arabic letter Waw with Hamza above"
(which was worth the effort of looking up :-) It is in the "Lo" ("other
letter") Unicode category and so is a UnicodeLetter according to
ECMAScript syntax, and a valid IdentifierStart .

Richard.

Feb 19 '07 #27
Randy Webb said the following on 2/18/2007 4:38 PM:
VK said the following on 2/18/2007 1:00 PM:
<snip>
>Respectively I suggested to both of you to shut up and stop pretending
that the language evolution is evolving around anyone of you. 1999 is
was one meaning for $, 2007 it is all another, 2015 it can be
something completely else.

Me? Spouting about the "language evolution"? You must have me confused
with some figment of your imagination. Now, please back up that claim
with regards to me saying that. Or, even coming close.

And you actually wonder why I think you are a bona fide idiot?
I will take your lack of proof as evidence of you either realizing you
are as dumb/stupid as I thought you were or your realization of how
severely wrong you are (as usual).

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 23 '07 #28
VK
On Feb 23, 4:05 am, Randy Webb <HikksNotAtH... @aol.comwrote:
I will take your lack of proof as evidence of you either realizing you
are as dumb/stupid as I thought you were or your realization of how
severely wrong you are (as usual).
Are you positionning yourself as verbally abused by VK in this thread
- in response to your polit arguments - something like this?

<faqentry>
What does $(arg) call mean in JS?

The dollar symbol in javascript is one of the characters that are
allowed to be a part of an identifier, allowed at the beginning of an
identifier and so may be used as an entire identifier.

The language specification ECMAScript-262 3rd ed. tells that the
identifiers starting with $ sign should be used to signify machine
generated code (a notion apparently borrowed from Java). Regardless of
this the dollar symbol is often used in Identifiers where its uses is
unrelated to machine generated code.

Many libraries define $ as a function which is shortcut replacement
for document.getEle mentById method or which is customary extended DOM
elements selection method. These libraries include Prototype (where
the original use come from), jQuery, MooTools, etc.
</faqentry>

The meaning and usage of $ sign in regular expressions should be
removed as irrelevant. We don't create a FAQ for "what does ^ mean?"
or "what does /^foo$/ mean?" - so same for $.

Feb 23 '07 #29
VK said the following on 2/23/2007 11:32 AM:
On Feb 23, 4:05 am, Randy Webb <HikksNotAtH... @aol.comwrote:
>I will take your lack of proof as evidence of you either realizing you
are as dumb/stupid as I thought you were or your realization of how
severely wrong you are (as usual).

Are you positionning yourself as verbally abused by VK in this thread
- in response to your polit arguments - something like this?
No, I want you to back up your claims such as this:

<quote>
and I mean the holly right you and Mr.Cornford are trying to
reserve to answer: "this is unproper use of $ demonstrating the lack
of knowledge of however did this library".
</snip>

In which the "you" is referring to me.

If you want more of your preposterous claims then simply read the
messages in this thread where I have replied to you. Especially with
regards to $ and/or ECMA
<faqentry>
What does $(arg) call mean in JS?
Technically speaking, it means a function named $ is being called with
an argument. I have said that before (in this thread no less). That is
what it means and not a hill of beans more.
The dollar symbol in javascript is one of the characters that are
allowed to be a part of an identifier, allowed at the beginning of an
identifier and so may be used as an entire identifier.
Nice info from Richard but it is irrelevant to the question you have
modified to use in your faqentry request.
The language specification ECMAScript-262 3rd ed. tells that the
identifiers starting with $ sign should be used to signify machine
generated code (a notion apparently borrowed from Java). Regardless of
this the dollar symbol is often used in Identifiers where its uses is
unrelated to machine generated code.
Still irrelevant to the question you pose.
Many libraries define $ as a function which is shortcut replacement
for document.getEle mentById method or which is customary extended DOM
elements selection method. These libraries include Prototype (where
the original use come from), jQuery, MooTools, etc.
</faqentry>
And you still didn't answer the question you posed. What does $(arg)
mean in JS? (The original question was "What does $ mean in JS?" which
is a totally different question). As you stated the question, it means
what I said above. Nothing more, nothing less. A function named $ was
called with an argument of a variable named arg.
The meaning and usage of $ sign in regular expressions should be
removed as irrelevant. We don't create a FAQ for "what does ^ mean?"
or "what does /^foo$/ mean?" - so same for $.
So, you want an entry (based on your faqentry above) on a single
function name yet you argue against specialized entries? Think about
that one for a while. Then realize that you requested an entry and then
you yourself said we don't do it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 23 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11256
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL) on the server because of that. Our site will have an SSL certificate next week, so I would like to use AIM instead of SIM, however, I don't know how to send data via POST over https and recieve data from the Authorize.net server over an https...
2
5849
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues to execute the code until the browser send his reply to the header instruction. So an exit(); after each redirection won't hurt at all
3
23045
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which field is completed.
0
8502
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. 354 roberto@ausone:Build/php-4.3.2> ldd /opt/php4/bin/php libsablot.so.0 => /usr/local/lib/libsablot.so.0 libstdc++.so.5 => /usr/local/lib/libstdc++.so.5 libm.so.1 => /usr/lib/libm.so.1
1
8615
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one column fills. If the viewer selects two states, two columns fill. Etc. I could, if appropriate, have...
4
18312
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the user comes back to a page where he had a submitted POST data the browser keeps telling that the data has expired and asks if repost. How to avoid that? I tried registering all POST and GET vars as SESSION vars but
1
6878
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url http://www.mis.gla.ac.uk/biquery/training/ but each of the courses held have maximum of 8 people that could be
2
31451
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value to :parameter I dont like the idea of making the SQL statement on the fly without binding parameters as I dont want a highly polluted SQL cache.
3
23607
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the results of the picture half the size. The PHP I have installed support 1.62 or higher. And all I would like to do is take and image and make it fit a 3x3. Any suggestions to where I should read or look would be appreciated.
0
9731
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4342
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.