Can someone please explain to me what is wrong with my code? I'm trying to get the "phone" div to hide when email is pressed and show when it's not. But it's always on. The instructions seem straightforward enough, but I can not get it to work.
(Really I want the checkbox to be 3 radio buttons: phone, email, both but I can't even get this simplified version to work.)
How would you like us to contact you?<br> <input type="checkbox" name="ContactPreference" value="email" class="switch-phone" />Email <div class="offstate-phone"> What time of the day would you prefer to be contacted by phone? <select name="TimeOfDay"> <option value="Morning">Morning</option> <option value="Noon">Noon</option> <option value="Afternoon">Afternoon</option> <option value="Evening">Evening</option> </select> </div> <input type="Submit"> </form>
You had it mostly right, but you were missing a few required library files. FormAssembly's wForm library depends on the base2 library in order to overcome browser compatibilties in DOM handling. Try this code and see if it works for you:
How would you like us to contact you?<br> <input type="checkbox" name="ContactPreference" value="email" class="switch-phone" />Email <div class="offstate-phone"> What time of the day would you prefer to be contacted by phone? <select name="TimeOfDay"> <option value="Morning">Morning</option> <option value="Noon">Noon</option> <option value="Afternoon">Afternoon</option> <option value="Evening">Evening</option> </select> </div> <input type="Submit"> </form>