How does this js know $ get is function (id) {return document.getElementById (id); }
So, I was looking at a blog post with some javascript in it and there is something I am looking at that doesn't quite follow:
function pageLoadedHandler(sender, args) {
if (typeof(lastFocusedControlId) !== "undefined"
&& lastFocusedControlId != "")
{
var newFocused = $get(lastFocusedControlId);
if (newFocused) {
focusControl(newFocused);
}
}
In the above method, it calls $ get which I am assuming to be an alias
function(id) {
return document.getElementById(id);
}
The supplied js file does not contain the $ get argument.
This is a reserved alias and someone might provide a link that confirms this. If not, how does he know what $ get is?
a source to share
Yes, I found them: Quoting Msdn
Sys.UI.DomElement $ get Method
Provides a shortcut to the getElementById method of the Sys.UI.DomElement class. This member is static and can be called without instantiating the class.
http://www.asp.net/AJAX/Documentation/Live/ClientReference/Global/GetShortCutMethod.aspx
http://msdn.microsoft.com/en-us/library/bb397717.aspx
Very hard to find $ get
a source to share
I believe you are looking at ASP.NET AJAX keyboard shortcuts.
http://mattberseth.com/blog/2007/08/the_everuseful_get_and_find_as.html
a source to share