Hello!

Got a question that I havn't been able to answer. This is my last resort. :)

So, I have a list of dynamically created divs, with a link next to
them to show or hide text inside of it. I know how to do it when its
only a single box, but I dont know how to do it with a dynamic list.

The whole script gets created with php, so I don't know how many divs
there'll be. Normally I do the whole thing with javascript but I
really like jQuery, and I wanted to try to stick to using it.

So the result of the php script is something like this:

<a href="#" id=showtxt[1]">show text</a><div id="textbox[1]">Text here</div>
<a href="#" id=showtxt[2]">show text</a><div id="textbox[2]">Text here</div>
<a href="#" id=showtxt[3]">show text</a><div id="textbox[3]">Text here</div>
<a href="#" id=showtxt[4]">show text</a><div id="textbox[4]">Text here</div>

The jQuery code I have works for only one box...

$('#showtxt').click(function() {
        $('#textbox').slideToggle(400);
        return false;
});


I've tried for the past 2 hours to figure it out, and I've had no
luck. I think I might be using the wrong wording to describe my
problems, but either way I have no idea exactly what I'm looking for.
Any help is appreciated. :o)

Thanks in advance!

-- 
-Yasmary

Reply via email to