6
Options of variables and functions, for example:
$(function() {})
6
Options of variables and functions, for example:
$(function() {})
6
This is typical of jQuery. The $
is the jQuery library alias and this function is similar to window.onload
, ie: run when document has loaded.
Anyway the $
has no special meaning in Javascript. It is a normal variable name, which is commonly used by jQuery.
4
It is usually related to jQuery
. Otherwise they are only names for variables.
Javascript
:
The variable name can start with letters, dollar sign($) and underline(_). No numbers or other symbols are accepted. When the variable name is composed of more than one word it is not allowed to add space between them and it is customary to use Camelcase, where the first word begins with lowercase initial and the following with uppercase (variableName).
To create a variable in javascript just include the reserved word var in the front.
var texto;
Creating variables in this way is known as weak typing, where it is not necessary to define the nature of the information that will populate the variable. At any point in the code a variable that contained text can now contain a number.
In jQuery
:
All commands of the jQuery
we have the alias $ (cifrão)
as shortcut. We can mix smoothly JavaScript
native to jQuery
. The basis of jQuery
are the Selectors or Selectors, a selector defines in which part of html or tag we will execute our code jQuery
, the selectors of the jQuery
are identical to the CSS, for example, we have a div with the following extrusion, at first we can select this div in two ways in the jQuery
:
Thus $("div")
or $("#divTeste")
(Using the alias $) or
Thus jQuery("div")
or jQuery("#divTeste")
(Without using the alias $).
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
The code in question uses jQuery?
– Woss
This and relative can be either jQuery, Prototype, or any library that references the
$
. Although mostly used by jQuery library.– Guilherme Lautert
To complement: linked
– Hamurabi Araujo