Reputation: 12484
I know this might be a newbie question, but every-time i see code like this:
var table = $("table[title='Refresh']");
And also code like this:
$(function () {
$("#datepicker").datepicker();
});
i always sort of glaze over the $
symbol . It's a type of placeholder? or does it signify that its dynamic?
Upvotes: 0
Views: 2352
Reputation: 63970
The $
is not related to ASP.NET in particular, but rather to the possible use of jQuery or Prototype which both use the $
as an alias for a function. In the case of jQuery, $
is just a shortcut for not having to write jQuery as in the following example:
jQuery('selector').datepicker()
Is the same as writing
$('selector').datepicker()
jQuery provides the noConflict() method precisely to avoid conflicts with any other Javascript framework that may use the same $
alias.
Upvotes: 3
Reputation: 203841
That is JavaScript code. In JavaScript, $
is a legal name for a function or variable. It just means that someone defined a function with that name. You could define one yourself simply enough:
function $(){return "hello world";}
Then $()
would print "hello world"
.
Most famously, JQuery uses it as their selector function, in which it is used to query the page's DOM in a more powerful syntax than JavaScript's built in DOM querying methods, but there's nothing that guarantees that $
is JQuery's usage, it could be anything. (Note that I highly discourage you from actually defining $
yourself and using it as a function, as virtually all JS developers have learned to read it as the JQuery's implementation.)
Upvotes: 1
Reputation: 3591
This is jquery syntax of using $ symbol. Read more here http://www.learningjquery.com/2006/09/introducing-document-ready
Upvotes: 1
Reputation: 1729
It's the Shortcut / Alias to use in jQuery. Can be replaced with "jQuery " keyword."
Upvotes: 1
Reputation: 6270
This isn't part of ASP.NET, it's actually part of the JQuery library, which is a JavaScript library used for client side processing.
Upvotes: 1
Reputation: 164341
It is a JavaScript function, most likely jQuery. Many JS frameworks define $ as a root selector function, jQuery being the most famous/used of those.
It has nothing to do with ASP.NET.
Upvotes: 10