I am working on a project, in that they have used $$ to select an id/class. I am not sure about this. Can anybody tell me what does this mean. I googled it. But did not get proper answer.
$$("#" + idName + "text").setStyle('background', '#000');
I am working on a project, in that they have used $$ to select an id/class. I am not sure about this. Can anybody tell me what does this mean. I googled it. But did not get proper answer.
$$("#" + idName + "text").setStyle('background', '#000');
Share
Improve this question
edited Aug 4, 2016 at 10:13
Mi-Creativity
9,66410 gold badges40 silver badges48 bronze badges
asked Aug 4, 2016 at 10:10
Green ComputersGreen Computers
7534 gold badges17 silver badges25 bronze badges
6
-
I know that $$ in google chrome is the shorthand for
document.querySelectorAll
, but for use in jQuery? I don't think it makes a difference, but I can't substantiate that. – evolutionxbox Commented Aug 4, 2016 at 10:11 - 1 Possible duplicate of JavaScript Double Dollar Sign – hsz Commented Aug 4, 2016 at 10:12
- Can you post more JS? Specifically the IIFE arguments? – evolutionxbox Commented Aug 4, 2016 at 10:12
-
@hsz - I don't think it is a duplicate. That question was asking about a variable name with
$$
whereas this looks like a function library usage. – evolutionxbox Commented Aug 4, 2016 at 10:14 - Thank you all. Now i need to find which js library file uses $$ in my project. – Green Computers Commented Aug 4, 2016 at 10:18
3 Answers
Reset to default 3It's simply some library shorthand. Like jQuery assigns itself variable $
, some other library may assign $$
to itself to avoid conflicting with jQuery
In Javascript $ is a valid variable name, as is $$ and $$$. While you see it mostly used with jQuery, this is not unique to jQuery.
As another answer says, the project you're working with likely has a library which has assigned something to $$.
$ can also be used in variable names like this:
$foobar
foo$bar
Looking at $$("#" + idName + "text")
, the double $
doesn't make any sense to me but would be error in your code as jQuery shorthand alias is just a single $
and when you use $$(selector)
would make no sense.
But obviously you can assign the $$
or anything that is valid identifier to work with jQuery to make it no-conflict like below:
var $$ = jQuery.noConflict();
$$(selector); //now here $$ is jQuery alias with no problem
So, I suppose your code is using some library shorthand method jQuery alias as $$
.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745582851a4634356.html
评论列表(0条)