JQuery Select Question

OK here is my HTML

<div class="parent">
           <div><a class="remove">Remove</a></div>
           <div><a class="remove">Remove</a></div>
           <div><a class="remove">Remove</a></div>
</div>

Jquery

$(".remove").click(function (e) {
		e.preventDefault();			
		$(this).parent('div').remove();		
});

So what I want is when I click on a one particular Remove link, that Div should get removed but currently all Divs are getting removed. Perhaps when I am clicking on one remove, it is selecting all removes. Please help. Thank you.

it works for me as is.

Dormilich, You mean its behaving correctly in your side. But I checked in all browsers and it behaves wrongly in my side :frowning:

OK, Site Point, I will get back latyer. Let me try it first.

Issue solved. Those remove links were actually generated dynamically.So my first solution was not working in dynamic generated content but was working fine in static content.

Finally got the solution from here

Thank you :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.