Hey Everyone - I'm trying to get a .toggle event to fire when my user clicks on an id with "click-toggle".. I can't figure out why this isnt working. This is the code:
<html>
<head>
<script>
$(document).ready(function() {
$('#click-toggle').click(function() {
var clicked = $(this);
$(clicked).parent().parent().next().toggle('blind',400); return false;}); });
</script>
</head>
<body>
<div class="schedule-day-entry">
<div class="schedule-day-time"><p>10:00<reg>am</reg></p></div>
<div class="schedule-day-description"><p><a href="#" id="click-toggle">Title</a></p>
<开发者_如何学Go/div>
<div class="schedule-day-more-info"><p>Description</p></div>
</div>
<div class="schedule-day-entry">
<div class="schedule-day-time"><p>10:00<reg>am</reg></p></div>
<div class="schedule-day-description"><p><a href="#" id="click-toggle">Title</a></p>
</div>
<div class="schedule-day-more-info"><p>Description</p></div>
</div>
</body></html>
Any ideas? Thanks in advance!
You cannot have duplicate id attributes on a single webpage. id="click-toggle" I changed those to classes. Also, try the .toggle('blind') without the second argument. That seemed to work for me. There is also a good slideToggle() jquery function. You did remember to attach the jquery file didn't you?
<script type="text/javascript" src="jquery.js">
精彩评论