I try to hide the div when someone clicks on the switch on the form (second switch), but when I click on the first switch, the div shows a backup (switch). Here is my working code: http://jsfiddle.net/NKr7M/
Here is the HTML if you want:
<div class="grid howAnswer"> <div class="col-1"> <div class="button-left"> <img src="http://i.imgur.com/RVmh2rz.png" /> <input checked="checked" type="radio" id="id_delivery_0" value="chat" name="delivery" onclick="toggle(this)" /> </div> <div class="text-area top-text-area"> <label for="id_delivery_0"> AnswerChat By Appointment (Fastest) </label> </div> </div> <div class="col-1"> <div class="button-left" style="margin-left: 15px;"> <img src="http://i.imgur.com/8J0SEVa.png" /> <input type="radio" id="id_delivery_2" value="email" name="delivery" onclick="toggle(this)" /> </div> <div class="text-area bottom-text-area"> <label for="id_delivery_2"> AnswerMail ASAP (Within 1-2 days) </label> </div> </div> </div> <div class="formInput"> <p>Let try and hide this div</p> </div>
Like CSS:
body { font-family: Arial, Helvetica, sans-serif; } ul li { list-style: none; } .col-1 li.howDoPadding { padding-bottom: 10px!important; } .byAppointment { margin: 0 0 -4px 10px;} .offlineForm .lightBlueText { color: #80A9BD; display: inline; } *, *:after, *:before { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; } .grid:after { clear: both; content: ""; display: table; } .grid.howAnswer > div.col-1 { padding-left: 90px; position: relative; } .grid.howAnswer .button-left { width: 80px; position: absolute; margin-left: 20px; left: 0; top: 0; } .button-left img { margin-right: -5px; } .top-text-area { margin: 15px 0 10px; } .bottom-text-area { margin: 10px 0 15px; } .button-left { margin: 10px 0; } [class*='col-'] { float: left; padding-right: 20px; } [class*='col-']:last-of-type { padding-right: 0; } .col-1 { width: 100%; }
I am not very good at JavaScript, so I would really appreciate any help I can get. Thank you
source share