How to access select box using jQuery with Facebox and special select script

oMaRcO

New Member
I have a small script that allows for specific numbers to be provided in the second selection box based on the value of the first selection box. I have been told though that the following code will not work because the popup (facebox) duplicates the DOM (leaving me with 2 copies of that form and I'm trying to access it like there is only one copy.) Indeed, I was told that one solution would be to give the select box a class then access it like jQuery("#facebox theNewClass.select").blah() although past this explanation provided to me, I have no idea how to modify the code in order to follow these suggestions and create a working script. A bit of help would be greatly appreciated as I'm not exactly proficient in javascript.\[code\]<a href="http://stackoverflow.com/questions/14074807/#pop1" rel="facebox">pop1</a><div class="overlay" style="display:none;" id="pop1"><form name="program34" class="program34" method="post" action="#"> <select name="date" class="date" size="1" onchange="setOptions34(document.program34.date.options[document.program34.date.selectedIndex].value);"> <option value="" selected="selected"> - Date - </option> <option value="http://stackoverflow.com/questions/14074807/12/25/2013-3">12/25/2013 - All Day</option> </select> <select name="itemCount" class="itemCount" size="1"> <option value="" selected="selected">No date Selected</option> </select></form></div><script type="text/javascript"> function setOptions34(chosen){ var selbox = document.program34.itemCount; selbox.options.length = 0; if(chosen == ""){selbox.options[selbox.options.length] = new Option('No date selected','');} if(chosen == "12/25/2013-3"){ selbox.options[selbox.options.length] = new Option('0','0'); selbox.options[selbox.options.length] = new Option('1','1'); } }</script>\[/code\]
 
Back
Top