value of "selected" option returns "undefined" under jQuery 1.4.2
This routine used to work when I was using jQuery 1.3.2. Now that I've switched to 1.4.2 it fails. I've verified that returning to 1.3.2 fixes the problem.
I have a page which includes this select pulldown:
<select name="template" id="template_pulldown">
<option value="emerald" selected="selected">Emerald</option>
<option value="classic">Classic</option>
<option value="terminal">Terminal</option>
<option value="quidditch">Quidditch</option>
<option value="fruity">Fruity</option>
<option value="fourthjuly">Fourth of July</option>
</select>
Later on I have a routine which determines which option the user has selected:
template_value = $("select#template_pulldown>option:selected").attr('value');
This worked under 1.3.2, but under 1.4.2 this always sets template_value to "undefined".
I added some debug statements. This is what each of them returns:
// under 1.3.2: under 1.4.2:
alert($PJ("select").length); // 1 1
alert($PJ("select#template_pulldown").length); // 1 1
alert($PJ("select#template_pulldown>option").length); // 6 6
alert($PJ("select#template_pulldown>option:selected").length); // 1 0
Any help would be appreciated. Thank-you.