[jQuery] Hiding select options in IE?
<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>
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0"><!-- Letter Heading -->
<TBODY>
<TR>
<TD><!-- Left margin -->
</TD>
<TD>
<DIV><FONT face="Trebuchet MS" size=2><SPAN class=619515413-01062007>Hi
all,</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2><SPAN class=619515413-01062007>Thanks to
IE's inability to dynamically hide/show options within a select list, I need to
do it differenly, but I can't get it to work =/. This is what works as I'd
expect in FF;</SPAN></FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </DIV>
<DIV><FONT face="Trebuchet MS" size=2>//this is only for agency jobs - show
titles dependent on discipline selected<BR> discipline =
$("#admin-jobs .discipline_agency_row select option[@selected]").val();
<BR> $("#admin-jobs .jobtitle").hide();<BR>
titles_needed = "#admin-jobs .discipline" +
discipline;<BR> $(titles_needed).show();</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </DIV>
<DIV><FONT face="Trebuchet MS" size=2> $("#admin-jobs
.discipline_agency_row
select").change(function(){<BR> $("#admin-jobs
.jobtitle").hide();<BR> titles_needed =
"#admin-jobs .discipline" +
$(this).val();<BR> $(titles_needed).show();<BR> });</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </DIV>
<DIV><BR><FONT face="Trebuchet MS"><FONT size=2><SPAN
class=619515413-01062007>This is what I've come up with, and logically I think
it should work, but it doesn't. IE strips all the options out (but shows the
empty dropdown) and won't add any back in, and FF</SPAN> <SPAN
class=619515413-01062007>doesn't strip any out at
all.</SPAN></FONT></FONT></DIV>
<DIV><BR><FONT face="Trebuchet MS" size=2> <BR> //show
titles dependent on discipline selected<BR> $discipline =
$("#admin-jobs .discipline_agency_row select option[@selected]").val();
<BR> $titles_needed = "#admin-jobs .discipline" +
$discipline;<BR> alloptions = $("#admin-jobs
.jobtitle").clone();<BR> if ($discipline){<BR>
reqoptions = alloptions.find(
"option:not('"+$titles_needed+"')"
).remove();<BR> $("#admin-jobs .title_row
select").empty();<BR> $("#admin-jobs .title_row
select").append(reqoptions);<BR> }<BR> <BR> $("#admin-jobs
.discipline_agency_row select").change(function(){<BR>
$titles_needed = "#admin-jobs .discipline" +
$(this).val();<BR> alloptions = $("#admin-jobs
.jobtitle").clone();<BR> if ( $(this).val() ){<BR>
reqoptions = alloptions.find(
"option:not('"+$titles_needed+"')"
).remove();<BR> $("#admin-jobs .title_row
select").empty();<BR> $("#admin-jobs .title_row
select").append(reqoptions);<BR> }<BR> });</FONT></DIV>
<DIV><FONT face="Trebuchet MS" size=2></FONT> </DIV>
<DIV><SPAN class=619515413-01062007><FONT face="Trebuchet MS" size=2>Anyone got
a method that does work, or does a plugin exist to counter IE's
bug?</FONT></SPAN></DIV>
<DIV align=left><FONT face="Trebuchet MS" size=2>
<P><B>Luc Pestille</B><BR>Web Designer</P></FONT></DIV>
<DIV> </DIV></TD>
<TD><!-- Right margin -->
</TD>
</TR><!-- Disclaimer -->
<TR>
<TD COLSPAN="3"><BR>
<DIV STYLE="FONT-SIZE: 7pt; COLOR: gray; FONT-FAMILY: verdana" ALIGN="justify">
<FONT COLOR="silver">
</FONT> </DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<DIV STYLE="FONT: 10px/1.4 verdana,arial; COLOR: #aaaaaa"><IMG STYLE="MARGIN: 10px 0px" HEIGHT="100" ALT="in2 is part of the BWP Group" SRC="cid:4e5b50368a@6ee347ad-2e39" WIDTH="600" BORDER="0">
<P>in2, Thames House, Mere Park, Dedmere Road, Marlow, Bucks, SL7 1PB<BR>tel: +44 (1628) 899700 | fax: +44 (1628) 899701 | email: <A HREF="mailto:sales@in2.co.uk">sales@in2.co.uk</A> | web: <A HREF="http://www.in2.co.uk/">www.in2.co.uk</A></P>
<P>This message (and any associated files) is intended only for the use of jquery-en@googlegroups.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not jquery-en@googlegroups.com 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 jquery-en@googlegroups.com and do not necessarily represent those of the company. </P>
</DIV></BODY></HTML>