Saturday October 11 2008
jquery show/hide
I’m trying to do something with jquery but it just isn’t working. I’ve got a list of entry titles that want to be hidden until the user clicks on the h2 tag above it.
Here is the code - I’ve also posted this on the EE forums.
<h2 class="toggle">All Teachers</h2>
<div class="view">
{exp:weblog:entries weblog="teachers" orderby="date" sort="desc" limit="100" status="open" dynamic="off" disable="member_data|pagination|trackbacks"}
{categories}<h3><a href="{permalink=">{title}</a></h3>{/categories}
{/exp:weblog:entries}
</div>
<scr*pt type="text/javascript">
$(document).ready(function(){
$('div.view').hide();
$('h2.toggle').click(function(){
$('div.view').show();
$(this).hide();
});
});
</scr*pt>
*edit* fixed a typo in the code, but it’s still not working.






Peter wrote 13 words on Saturday Oct 18, 2008 at 06:21 PM
Hi Sean
This should work as supposed:
$(document).ready(function(){
$(‘div.view’).hide();
$(‘h2.toggle’).click(function(){
$(this).next().toggle();
});
});
Sean. wrote 17 words on Sunday Oct 19, 2008 at 08:07 AM
Peter,
Thanks, I appreciate your comment here and on the EE forum. I did get it working.