[jQuery] How to bind to multiple elements

[jQuery] How to bind to multiple elements


Hi!
Well, i'll quickly describe my problem.
In a page, i've multiple occurrence of:
[code]
    <div id="images">
        <div id="imagencap" style="float:left;">
            <img src="fileName.jpg" />
            <p id="caption_id">
            caption_text
            
        </div>
    </div>
[/code]
I would do, that when i click on a "caption_text", the relative
paragraph tag hide, and a textarea appears, with the text of the

.
Then, i've scripted this:
[code]
    $("#images").find("#imagencap")
    .click(function(e){
        if($(this).children().is("textarea")){ return; }
        var myP = $(this).find("p");
        var myCaption = myP.text();
        var myId = myP.attr("id");
        var textarea = "<textarea id="+myId+">"+myCaption+"</textarea>";
        var buttons = "[<a href='#'>SAVE</a>] [<a href='#'>CANCEL</a>]";
        myP.hide();
        myP.before("<br />"+textarea+"<br />"+buttons);
    });
[/code]
... That works!. But only for the first occurrence!
Where is the problem?
Thanks :)