javascript tutorial - [Solved-4 Solutions] Dollar sign - javascript - java script - javascript array
Problem:
Why would a JavaScript variable start with a dollar sign?
Solution 1:
var $email = $("#email"); // refers to the jQuery object representation of the dom object
var email_field = $("#email").get(0); // refers to the dom object itself
click below button to copy the code. By JavaScript tutorial team
Solution 2:
Angular Namespaces $ and $$
To prevent accidental name collisions with your code, Angular prefixes names of public objects with $ and names of private objects with $$,do not use the $ or $$ prefix in our code.
Solution 3:
var _ = function() { alert("hello from _"); }
var \u0024 = function() { alert("hello from $ defined as u0024"); }
var Ø = function() { alert("hello from Ø"); }
var $$$$$ = function() { alert("hello from $$$$$"); }
click below button to copy the code. By JavaScript tutorial team
Solution 4:
a jQuery wrapped DOM element
Ex:
var name = 'jQuery';
var lib = {name:'jQuery',version:1.6};
var $dataDiv = $('#myDataDiv');