On 11/29/06, Mike Alsup <[EMAIL PROTECTED]> wrote:

Yes, that's a good thought but IE is too slippery.  getAttribute(..),
val(), .value, et al, all return "identical" values whether the
attribute is missing or it has an empty string.  And the value
attribute for an option always exists whether or not it appears in the
markup.  defaultValue doesn't help either.


How about something like this[1]:

var selectBox = document.getElementById('selectBox');
var selectedOption = selectBox.options[selectBox.selectedIndex];
var hasValueAttr = selectedOption.attributes['value'].specified;

[1] See the last section of
http://www.quirksmode.org/dom/tests/attributes.html
--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to