tags:

views:

60

answers:

3

Hi

I know the spec allows both ' and " as delimiters for attribute values, and I also know it's a good practice to always quote.

However I consider " being the cleaner way, maybe it's just me having grown up with C and C++' syntax.

What is the cleanest way of quoting attribute values and why? Please no subjective answers.

A: 

Either is good, as long as you use it. " is more popular.

Delan Azabani
+2  A: 

Both are fine, but Double quotes are better (IMHO) as you reduce the risk of dynamic values causing errors. e.g.

<input value='${lastName}'/>

<input value='O'Graddy'/>
                ^^^^^^^

vs.

<input value="${lastName}"/>

<input value="O'Graddy"/>
scunliffe
True, though you should really be escaping everything instead of hoping for the best.
Delan Azabani
A: 

What is the cleanest way of quoting attribute values and why? Please no subjective answers.

Sorry, there are only subjective answers to that question.

Ms2ger