0

I am having a strange issue.

I have created a code snippet where the user can create dynamic input elements and remove them as well

When I click the remove class then it's not triggering the onclick event.

<input type='button' value='Add Button' id='addButton'>
<div id="TextBoxesGroup"></div>

I have created a jsFiddle

http://jsfiddle.net/squidraj/b4Cs8/2/

Raj
  • 1,377
  • 6
  • 23
  • 48

1 Answers1

0

Use event delegation in jquery

$(document).on("click" , "a.removeField", function (event) {
      event.preventDefault();
      $(this).parent().remove();
     counter--;            
});

Fiddle

Sudharsan S
  • 15,336
  • 3
  • 31
  • 49