Append form

Append form

by Nibin George

HTML

<div class="questionAndAns">
Question:This is my question
   <div class="ans">Answer:This is my first answer</div>
   <div class="ans">Answer:This is my second answer</div>
   <div class="ans">Answer:This is my third answer</div>
</div>

JavaScript

$('.ans').live('click',function(){
    $(this).find('.followup').remove();
    var formElement = "<form class='followup'>Q:<input type='text' name='firstname'/><input type='submit' value='Submit'/></form>"
    $(this).append(formElement);
});