>I've seen jQuery developers use the following syntax when declaring
>variables. Does the $ character help in any way? Does it do anything
>or is it mostly just for convenience.
>
>For example is this:
>var paras = $("p");
>
>better than this:
>var $paras = $("p");

The $paras declaration identifies it as a jQuery object. The "$" doesn't
hold any special function, it's just a way of using Hungarian Notation.

Take the following:

var el = document.getElementById("products");
var $el = $(el);

You now you know that "el" is a reference to the straight DOM object, while
$el is a reference to the jQuery equivalent.

-Dan

Reply via email to