[jQuery] Checking select option has class?

[jQuery] Checking select option has class?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" size=2><SPAN
class=121132916-18102006>Nope, that didn't work - I suspect (read:complete
guess) because #myselect is the select element itself, not the option
within it. Anyone else offer a solution?</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </DIV>
<DIV align=left><FONT face="Trebuchet MS" size=2>
<DIV><FONT face="Trebuchet MS"
size=2><SPAN>if ( $('#myselect').is(":disabled")
){</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>    //don't submit
the form</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>}</SPAN></FONT></DIV></FONT></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> discuss-bounces@jquery.com
[mailto:discuss-bounces@jquery.com] <B>On Behalf Of </B>Sam
Collett<BR><B>Sent:</B> 18 October 2006 17:07<BR><B>To:</B> jQuery
Discussion.<BR><B>Subject:</B> Re: [jQuery] Checking select option has
class?<BR></FONT><BR></DIV>
<DIV></DIV>On 18/10/06, <B class=gmail_sendername>Luc Pestille</B> <<A
href="mailto:Luc.Pestille@in2.co.uk">Luc.Pestille@in2.co.uk</A>> wrote:
<DIV><SPAN class=gmail_quote></SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><BR></TD>
<TD>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>Hi all,</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>Thanks to IE's wonderful
ommission of disabled="disabled" for options in select drop downs, I
need to add a class to disabled options and and check for that class
when the form is submitted. How do I check the selected option has
a class within a select? </SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </DIV>
<DIV><FONT face="Trebuchet MS"
size=2><SPAN>if ( $('#myselect').get(0).hasClass("disabled")
){</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>    //don't
submit the form</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>}</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>???</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>TIA.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV align=left>
<TABLE align=left>
<TBODY>
<TR>
<TD vAlign=top><IMG height=33
src="http://www.in2.co.uk/images/in2-logo-small.gif" width=30></TD>
<TD width=7><BR></TD>
<TD vAlign=top><FONT face="Trebuchet MS" size=2>
<P><B>Luc Pestille</B><BR>Web Designer </P>
<P>e: <A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:luc.pestille@in2.co.uk"
target=_blank>luc.pestille@in2.co.uk</A><BR>t: +44 (0)1628 899
700<BR>f: +44 (0)1628 899 701
</P></FONT></TD></TR></TBODY></TABLE></DIV>
<DIV> </DIV></TD>
<TD><BR></TD></TR>
<TR>
<TD colSpan=3><BR>
<DIV style="FONT-SIZE: 7pt; COLOR: gray; FONT-FAMILY: verdana"
align=justify>In2<BR>Thames House<BR>Mere Park<BR>Dedmere
Road<BR>Marlow<BR>Bucks<BR>SL7 1PB<BR><BR>Tel 01628 899700<BR>Fax 01628
899701<BR>e: <A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:sales@in2.co.uk" target=_blank>sales@in2.co.uk</A><BR>i: <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.in2.co.uk/"
target=_blank>www.in2.co.uk</A><BR><BR><FONT color=silver>This message
(and any associated files) is intended only for the use of <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss@jquery.com" target=_blank>discuss@jquery.com</A>
and may contain information that is confidential, subject to copyright
or constitutes a trade secret. If you are not <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss@jquery.com" target=_blank>discuss@jquery.com</A>
you are hereby notified that any dissemination, copying or distribution
of this message, or files associated with this message, is strictly
prohibited. If you have received this message in error, please notify us
immediately by replying to the message and deleting it from your
computer. Messages sent to and from us may be monitored. Any views or
opinions presented are solely those of the author <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:Luc.Pestille@in2.co.uk"
target=_blank>Luc.Pestille@in2.co.uk</A> and do not necessarily
represent those of the company.
<BR><BR></FONT></DIV></TD></TR></TBODY></TABLE></DIV></DIV><BR>_______________________________________________<BR>jQuery
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss@jquery.com">discuss@jquery.com</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://jquery.com/discuss/"
target=_blank>http://jquery.com/discuss/</A><BR><BR><BR></BLOCKQUOTE></DIV><BR>I
think this should work:<BR><BR>
<DIV><FONT face="Trebuchet MS"
size=2><SPAN>if ( $('#myselect').is(":disabled")
){</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN>    //don't submit
the form</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS"
size=2><SPAN>}</SPAN></FONT></DIV><BR></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/