Javascript JQuery var $varname is not a PHP variable!

JQuery

JQuery (Photo credit: Wikipedia)

Recently, I came across some JQuery code with a variable declaration having a $ sign before the variable name.

Below is an excerpt of the code.

var markup = "<p>" + category.description + "</p><ul data-role='listview' data-inset='true'>",
$header = $page.children( ":jqmData(role=header)" ),
markup += "</ul>";

After doing a brief search I found the following explanation very useful and this might take out the confusion that may have you screaming to yourself “Is JQuery now running PHP?”

“ It just seems to be common practice by a lot of jQuery people smarter than us to signify it’s a jQuery object stored in that variable, it has zero to do with jQuery itself per se”.

via [jQuery] var $varname – jQuery Forum.

Advertisements

One thought on “Javascript JQuery var $varname is not a PHP variable!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s