If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I specifically stated that it wasn't for people who use javascript libraries. Though I guess you do have a point. Mabye a symbol that is less used like the underscore (_) would be a better choice.

And who never will use any script libraries that use the $ variable. It's good to plan ahead.

Underscore might be a better choice, but eventually would run afoul of someone else who had a similar yet different idea for the underscore if your code were combined with theirs.

The general rule with global variables is to keep them long and descriptive so as to avoid conflicts with other scripts and to make the code human readable.

Shorter but still descriptive variables can be used within the local scope of a function.

In the long run, any extra typing this involves will by far be made up for by the ease of reading and understanding of the code (years later or for someone looking at it for the first time), and its ability to 'play nice' with other code.

Incidentally, jQuery can coexist with a script or script library that uses $ like you do or for any other purpose via its noConflict() mode, but that adds a layer of complexity. And as far as I know, none of the other $ hogging libraries can do that.

It's unwise to pollute your code with a global variable which is so commonly used by other libraries. It makes all your code potentially (probably) incompatible with them. If I'm writing in ordinary javascript, I use a clip collection. One double click and I get:

document.getElementById('');

with the cursor insertion point between the two ' marks, all the time savings I need.