Using jQuery I am trying to create a function to show and hide the DIV below the table/tr that has been clicked, but when I click in one, all the DIVs will slide up, also slide down it is not working.
I tried if ($(".container:first").is("hidden"))
but I guess is not the first element under element clicked but first element on the document.
How do I get this working?
Based on the following example.
<html>
<head>
<script type="text/javascript" src="jquery-1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".header").click(function(){
if ($(".container").is("hidden")){
$(".container").slideUp("slow");
} else {
$(".container").slideDown("slow");
}
});
});
</script>
</head>
<body>
<table class="header">
<tr><td>Row1</td></tr>
</table>
<div class="container">Container 1</div>
<table class="header">
<tr><td>Row2</td></tr>
</table>
<div class="container">Container 2</div>
</body>
</html>