Hiding/showing multiple DIVs
Hello all,
I'm new to jQuery, and I'm having issues with showing my DIVs correctly. The problem with the script at the moment, is that it currently opens up every single .display div, whereas I only want it to open up the one which corresponds to the .input a.edit which I've clicked.
The script hides them individually, displays the hide button and makes the show button display correctly like I wish, but it's displaying all the the .display div's at the same time which isn't what I want.
For reference here is my jQuery script:
- <script type="text/javascript">
- $(".input a.edit").click(function () {
- $(this).hide()
- $(".hide").show()
- $(".display").slideDown('fast');
- $(this).parents(".pane").fadeOut('fast');
- });
- $(".input a.hide").click(function () {
- $(".pane").fadeIn('fast')
- $(".input a.edit").show();
- $(this).parents(".display").slideUp('fast');
- });
- </script>
And the HTML (which I've cleaned up to make it more readable):
- <div class="input">
- <div class="display">
- <div class="time">(time)</div>
- <a class="hide">Hide</a>
- <div class="fix">(content)</div>
- </div>
- <div class="row1">
- <div class="pane">
- (content)
- <a class="edit">Show</a>
- (time)
- </div>
- </div>
- <hr>
Thanks for any help and suggestions you can provide. :)