Tuesday, December 29, 2009

[jQuery] Help on Independent DIV's that toggle!!

Hi everyone,

I got one DIV working with my toggle script. Works great.

I need to add a few more DIV's with the same toggle script on the SAME
PAGE. I wanted to duplicate the same script with different DIV names,
but it didn't work.

How can i use the same script with INDEPENDENT DIV's on the same page?

Here is my good independent script.

<script type="text/javascript">
$(document).ready(function() {
$('#content1').hide();
$('a#slick-toggle').click(function() {
$('#content1').slideToggle(400);
$(this).text($(this).text() == 'More Details' ? 'Close' : 'More
Details'); // <- HERE
return false;
});
});
</script>

No comments: