$

From FirebugWiki

(Difference between revisions)
Jump to: navigation, search
m (Linked to MDN)
(Added description of syntax and linked back to Command Line API)
Line 2: Line 2:
If the JavaScript on the page already defines <code>$</code> for something else (like e.g. jQuery does), it will not be overwritten by this command.
If the JavaScript on the page already defines <code>$</code> for something else (like e.g. jQuery does), it will not be overwritten by this command.
 +
 +
== Syntax ==
 +
<source lang="javascript">
 +
$(id)
 +
</source>
== Parameters ==
== Parameters ==
Line 8: Line 13:
== Examples ==
== Examples ==
-
 
<source lang="javascript">
<source lang="javascript">
$("element")
$("element")
Line 14: Line 18:
This returns the element with the id <code>element</code>.
This returns the element with the id <code>element</code>.
 +
 +
== See also ==
 +
[[Command Line API]]

Revision as of 10:44, 5 July 2012

This command returns a single HTML or XML element with the given id. This means it is actually a shortcut for document.getElementById().

If the JavaScript on the page already defines $ for something else (like e.g. jQuery does), it will not be overwritten by this command.

Contents

Syntax

$(id)

Parameters

id

Id of the element to return. (required)

Examples

$("element")

This returns the element with the id element.

See also

Command Line API

Personal tools