html - how to use select element onchange event to fill hidden element -
any appreciated, i've been pulling hair out trying make work!
i have form 5 select elements this:
<select name="program1" class="floatctrl" id="cname" required="required" onchange="document.getelementbyid('program1_text').value=this.options[this.selectedindex].text"> <option value="" selected> </option> <option value="1"> break dancing 7/2/2013 $40.00</option> <option value="2"> guitar 7/10/2013 $40.00</option> <option value="3"> drums 7/12/2013 $40.00</option> <option value="4"> drawing 6/19/2013 $78.00</option> <option value="5"> watercolor painting 6/19/2013 $78.00</option> <option value="6"> kids art 8/7/2013 $30.00</option> <option value="7"> book making 6/12/2013 $40.00</option> <option value="8"> writing 6/25/2013 $50.00</option> <option value="9"> dog obedience 6/5/2013 $45.00</option> <option value="10"> skateboarding 7/30/2013 $40.00</option> <option value="11"> dodgeball 8/7/2013 $5.00</option> <option value="12"> jumprope 8/6/2013 $25.00</option> <option value="13"> swimming 6/2/13 $40.00</option> <option value="14"> games 7/2/2013 $20.00</option> <option value="15"> tennis 1 6/18/2013 $30.00</option> <option value="16"> tennis 2 6/25/2103 $30.00</option> <option value="17"> tennis 3 7/2/2013 $25.00</option> <option value="18"> tennis 4 7/16/2013 $25.00</option> <option value="19"> tennis 5 7/23/2013 $35.00</option> <option value="20"> tumbling 5/23/2013 $25.00</option> <option value="21"> backyard discovery 7/20/2013 $5.00</option> <option value="22"> applegate discovery 7/27/2013 $10.00</option> <option value="23"> mountain adventure 8/3/2013 $10.00</option> </select>
and hidden input each 1 this:
<input type="hidden" name="program1_text" id="program1_text" value="" />
i'm trying fill value of hidden element "program1_text" text selected option onchage event of select element "program1". have researched lot , solution 1 keep coming across, can't work. can see mistake?
replace getelementbyid getelementbyid. javascript case sensitive
Comments
Post a Comment