michele
michele

Reputation: 26598

remove elements from dynamic form

I have this form: http://jsfiddle.net/michelejs/JrBrR/

How can I implement the remove Paragraph function in jquery?

Thanks a lot.

Upvotes: 0

Views: 361

Answers (2)

Saeed Neamati
Saeed Neamati

Reputation: 35822

You can use jQuery's live method to bind to future instances of paragraphs. For each new form, you can write:

 $('.deleteButton').live(function(){
      $(this).siblings('p').remove();
 });

live is like bind but acts on any element that is added in future. :)

Upvotes: 2

Neil Knight
Neil Knight

Reputation: 48537

$("p").remove() should do the trick. Read up more about remove here:

jQuery Remove

Upvotes: 2

Related Questions