jquery - I'm trying to get divs to show consecutively on click -



jquery - I'm trying to get divs to show consecutively on click -

this 'click' trigger:

<li class="booking"><a href="#page_7">book me</a></li>

here's jquery:

<script type='text/javascript'> $('.booking').click(function(){ $('#svc_panel')fadein(function(){ $('#date_panel,#time_panel,#confirm_panel')hide(); }); }); $('.date_button').click(function(){ $('#date_panel').fadein(function(){ $('#svc_panel,#time_panel,#confirm_panel,').hide(); }); }); $('.time_button').click(function(){ $('#time_panel').fadein(function(){ $('#svc_panel,#date_panel,#confirm_panel').hide(); }); }); $('.confirm_button').click(function(){ $('#confirm').fadein(function(){ $('#csvc_panel,#date_panel,#time_panel').hide(); }); }); }); </script>

and html:

<div id="svc_panel"> <table style="margin-left:30px;width:100%;text-align:left;"> <tr style="height:25px;"> <th style="width:500px;font-weight:bold;font-size:14px;">service</th> <th style="width:100px;font-weight:bold;font-size:14px;">duration</th> <th style="width:100px;font-weight:bold;font-size:14px;">cost</th> </tr> <tr> <td><a href="#" class="date_button">first service</a></td> <td>60 minutes</td> <td>$100</td> </tr> <tr> <td><a href="#" class="date_button">second service</a></td> <td>30 minutes</td> <td>$60</td> </tr> <tr> <td><a href="#" class="date_button">third service</a></td> <td>90 minutes</td> <td>$140</td> </tr> </table> </div> <div id="date_panel"> <p>user picks date: <input id="datepicker" class="time_button" type="text"></p> </div> <div id="time_panel"> <div>user picks time on: <span id="target"></span></div> <table> <tr> <td class="time_button"><a href="#">11:30 am</a></td> </tr> <tr> <td class="time_button"><a href="#">12:30 pm</a></td> </tr> <tr> <td class="time_button"><a href="#">2:00 pm</a></td> </tr> </table> </div> <div id="confirm_panel"> you've chosen (service) on (date) @ (time). correct? <a href="#" class="confirm_button">yes</a> </div>

typos enemy.

$(document).ready(function(){ $('#svc_panel,#date_panel,#time_panel,#confirm_panel').hide(); $(".booking").click(function(){ $('#svc_panel').fadein(function(){ $('#date_panel,#time_panel,#confirm_panel').hide(); }); }); $(".date_button").click(function(){ $('#date_panel').fadein(function(){ $('#svc_panel,#time_panel,#confirm_panel,').hide(); }); }); $('.time_button').click(function(){ $('#time_panel').fadein(function(){ $('#svc_panel,#date_panel,#confirm_panel').hide(); }); }); $('.confirm_button').click(function(){ $('#confirm_panel').fadein(function(){ $('#svc_panel,#date_panel,#time_panel').hide(); }); }); });

this working code. enjoy.

<li class="booking"><a href="#page_7">book me</a></li> <div id="svc_panel"> <table style="margin-left:30px;width:100%;text-align:left;"> <tr style="height:25px;"> <th style="width:500px;font-weight:bold;font-size:14px;">service</th> <th style="width:100px;font-weight:bold;font-size:14px;">duration</th> <th style="width:100px;font-weight:bold;font-size:14px;">cost</th> </tr> <tr> <td><a href="#" class="date_button">first service</a></td> <td>60 minutes</td> <td>$100</td> </tr> <tr> <td><a href="#" class="date_button">second service</a></td> <td>30 minutes</td> <td>$60</td> </tr> <tr> <td><a href="#" class="date_button">third service</a></td> <td>90 minutes</td> <td>$140</td> </tr> </table> </div> <div id="date_panel"> <p>user picks date: <input id="datepicker" class="time_button" type="text"></p> </div> <div id="time_panel"> <div>user picks time on: <span id="target"></span></div> <table> <tr> <td class="confirm_button"><a href="#">11:30 am</a></td> </tr> <tr> <td class="confirm_button"><a href="#">12:30 pm</a></td> </tr> <tr> <td class="confirm_button"><a href="#">2:00 pm</a></td> </tr> </table> </div> <div id="confirm_panel"> you've chosen (service) on (date) @ (time). correct? <a href="#" class="confirm_button">yes</a> </div>

http://jsfiddle.net/incubator/sfhss/16/

jquery hide show html

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -