There are so many ways to remove a specific div or more than one div of same class or id. It is tried to present all methods.

1. You can remove first or last div of same class or id.

The following code would remove first div of same class;

$(‘.div-same-class:first’).remove();

Similarly when we put last instead of first, it would remove last div of same class.

$(‘.div-same-class:last’).remove();

Note: In above example, class is used to remove the specefic div, same can be process with same id as changing code respectively. $(‘#div-same-id:first’).remove(); and $(‘#div-same-id:last’).remove();

to be continued…..

 

Leave a Reply