Here is the html from which I want to remove the div element 'div' by clicking the link.
<div> <a href="javascript:void(0)" class="link">My link</a> </div>
To access the preceding element I will use the .parents() method of jQuery and then call
the method .remove() to remove the 'div' element.
Here is the code...
$('a.link').click(function() { $(this).parents('div:first').remove(); });
Nice....
ReplyDeleteThanks!!
Delete