I have a site the generated a row of data from MySQL db. The parent element DIV is called "enclosure". This shows up as hidden when page loads. I have a link "show/hide" that I'm using to show the data when click using jQuery.
My problem:
Since all the rows for every record are in a div called 'enclosure' - the show/hide link when clicked only shows or hides the first record on the page, no matter what show/hide link I click.
<head>
<script>
function ShowHide() {
$('#enclosure').animate({"height": "toggle"}, {duration: 1000});
}
</script>
</head>
<body>
<?php
$query = "SELECT * FROM info ORDER by ticket DESC LIMIT 10";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo nl2br ("<a onclick=\"ShowHide(); return false;\" href=\"#\">Show/hide</a><div id=\"enclosure\" style=\"display:none\">{$row['ticket']}</div>" );
}
?>
</body>