javascript - Determine if ONLY ONE option is selected in multi select -


With the following code, I am using a multi select box to enable the user to select multiple options . When I select one of the options, I am displaying a preview image of the selected option in the other partition.

All this works, but when I select more than one item, I would like to be able to update the div with the image preview to show the placeholder image.

Thoughts?

  & lt; Multiple id = "opt1-opts" & gt; Select & lt; Option value = "diesel_nova_rts 066 99 6" & gt; Nova RTS-06 - 1996 & lt; / Options & gt; & Lt; Option value = "diesel_nova_rts_6_1998" & gt; Nova RTS-06 - 1998 & lt; / Options & gt; & Lt; Option value = "diesel_nava_rts_6_1999" & gt; Nova RTS-06 - 1999 & lt; / Options & gt; & Lt; Options & gt; Nova 40 LF - 2011 & lt; / Options & gt; & Lt; Option value = "new_flyer_40lf_2011" & gt; New Flyer 40 LF-2011 & lt; / Options & gt; & Lt; Option value = "orion_v_1995" & gt; Orion VWC - 1995 & lt; / Options & gt; & Lt; Option value = "orion_v_1996" & gt; Orion VWC - 1996 & lt; / Options & gt; & Lt; Option value = "orion_v_1999" & gt; Orion VWC - 1999 & lt; / Options & gt; & Lt; Options & gt; Orion 40 LF - 2011 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Div id = "dialog-bus-type-image-info-area" & gt; & Lt; Img src = "IMGS / LFS 60102.jpg" range = 0> & Lt; / Div & gt; // bus type dialog script $ ("# opt1-opts") Change (function () {$ ("# dialog-bus-type-image-info-area") empty (). Append ("& lt; img Src = 'IMGS / Bus Type /" + $ ("# op- Option option: selected "). Val () +". Jpg 'border =' 0 '/' & gt;);});  

$ ("# opt1-opts option: selected") Length < / Code> How many children will be selected for you


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -