[jQuery] Re: vs '

2007-07-26 Thread Klaus Hartl


Stephan Beal wrote:

On Jul 26, 6:37 pm, Mitchell Waite [EMAIL PROTECTED] wrote:

This going will make me sound really dumb but what is the difference between
using single quote versus double quotes in jQuery, e.g.


Mitchel, PLEASE don't hijack other people's threads to post a
question. Start a new thread! Thread hijacking is one of the most
annoying things a forum-goer can do!


I second that plea! Please be aware that mail clients like Thunderbird 
do not thread messages by subject but by some mail headers. Thus hitting 
reply and changing the subject *does not* create a new thread.


Not only do you add unrelated messages to a thread I'm following like 
for example Whats wrong with the tabs plugin and keep me constantly 
busy because me thinking there's something new I need to reply to and 
then again realizing that it's just a reply to the hijacked thread.


You also decrease your chance to get an answer if your new topic is 
buried away in another thread say 30% of the people here are not 
interested in (I just can't follow every single thread here).


I know less friendly communities where you get filtered away pretty fast 
if you do hijack threads even once by the way.


Thanks!


--Klaus


[jQuery] Re: vs '

2007-07-26 Thread Rob Desbois

Sean,

Attributes in (X)HTML don't need to be double-quoted, again single-quotes
are equally valid there so 'a href=...' and a href='...' are
effectively the same and both valid.
I know you probably know, I just wanted to rephrase It is easier to type an
html string if you use single quotes: in case :-)

--rob


On 7/26/07, Sean Catchpole [EMAIL PROTECTED] wrote:


On 7/26/07, Mitchell Waite [EMAIL PROTECTED] wrote:
 This going will make me sound really dumb but what is the difference
between
 using single quote versus double quotes in jQuery, e.g.

Mitchell, the concept of single vs double quotes is more of a javascript
question.
The simple answer is that there's no difference really. It is easier to
type an html string if you use single quotes:
Single: var html = 'a href=#link/a';
Double: var html = a href\#\link/a';
But sometimes you might want to use double instead:
Single: var str = 'I\'m in love';
Double: var str = I'm in love;

So just use whichever you feel is better for the situation. Some people
are used to single quotes representing characters, whereas others think html
= double quotes, javascript = single quotes.

~Sean





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: vs '

2007-07-26 Thread Mitchell Waite
Thanks to Sean, Aaron and Rob, this is now very clear. I have used both and
it was just bugging me. I sort of prefer double quotes, its just more like
everything else I do.

 

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sean Catchpole
Sent: Thursday, July 26, 2007 9:48 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re:  vs '

 

On 7/26/07, Mitchell Waite [EMAIL PROTECTED] wrote:
 This going will make me sound really dumb but what is the difference
between
 using single quote versus double quotes in jQuery, e.g. 

Mitchell, the concept of single vs double quotes is more of a javascript
question.
The simple answer is that there's no difference really. It is easier to type
an html string if you use single quotes:
Single: var html = 'a href=#link/a';
Double: var html = a href\#\link/a'; 
But sometimes you might want to use double instead:
Single: var str = 'I\'m in love';
Double: var str = I'm in love;

So just use whichever you feel is better for the situation. Some people are
used to single quotes representing characters, whereas others think html =
double quotes, javascript = single quotes. 

~Sean 



[jQuery] Re: vs '

2007-07-26 Thread Sean Catchpole
On 7/26/07, Mitchell Waite [EMAIL PROTECTED] wrote:
 This going will make me sound really dumb but what is the difference
between
 using single quote versus double quotes in jQuery, e.g.

Mitchell, the concept of single vs double quotes is more of a javascript
question.
The simple answer is that there's no difference really. It is easier to type
an html string if you use single quotes:
Single: var html = 'a href=#link/a';
Double: var html = a href\#\link/a';
But sometimes you might want to use double instead:
Single: var str = 'I\'m in love';
Double: var str = I'm in love;

So just use whichever you feel is better for the situation. Some people are
used to single quotes representing characters, whereas others think html =
double quotes, javascript = single quotes.

~Sean


[jQuery] Re: vs '

2007-07-26 Thread Aaron Heimlich

For that code...absolutely nothing (that I can recall off-hand, anyway).
However, there is something you should be aware of:

If you want to use a ' within a string that is delimited by 's, then you
have to escape it, like so:

'Mitchell\'s code'

The same goes for :

Aaron shouted \jQuery rocks!\ as loud as he could

Escaping quotes tends to make your code harder to read, though, so most
people, when they know a string will contain one type of quote, will delimit
it with the opposite type. For example:

Mitchell's code

'Aaron shouted jQuery rocks! as loud as he could'

On 7/26/07, Mitchell Waite [EMAIL PROTECTED] wrote:


 This going will make me sound really dumb but what is the difference
between using single quote versus double quotes in jQuery, e.g.



$('#spincursor').click(function() {

$(#spinner).show();

});



Or



$(#spincursor).click(function() {

$(#spinner).show();

});





--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com