Monday, March 26, 2007

difference about quotes and non-quotes in HTML select

I usually use a computed value with a dbcolumn to display values in a combo (the select HTML tag)
Suppose your returned HTML source looks like this:


<select id="mySelect" >

<option value=value 1>entry 1</option>

<option value=value 2>entry 2</option>

<option value=value 3>entry 3</option>

</select>



This bad ... the value attribute of should always be surrounded by quotes. Otherwise, jQuery will return only 'value' in IE (read that this is acceptable for FireFoxie, didn't verify, though)

So, always add an extra \" into my computed values, so that I will get:

<select id="mySelect" >

<option value="value 1">entry 1</option>

<option value="value 2">entry 2</option>

<option value="value 3">entry 3</option>

</select>


hmm, talk about little difference which wasted an hour of my time ... doh

No comments: