Mission: Add elements on the fly when a button is clicked. Also add the button dynamically. Match the textarea to the right ID.


$("h1").click(function(){ var target = $(this).next('div.tipContent') $("div.tipContent:visible").not(target).slideUp(); target.slideToggle(); }); $("div.tipContent p").append("<br clear='all' /><br /><a href='#' class='replyButton'>Reply</a>") $('a.replyButton') .livequery('click', function(event) { var commentID = $(this).parents("li.tipQuestion").attr("id"); $(this).parent().append("<br /><textarea id='text_" + commentID + "'>My ID is text_" + commentID + "'</textarea><br /><input type='button' value='Submit' />"); return false; });