Dipendra Km Dipendra Km - 1 year ago 147
jQuery Question

Can we remove the div having the id inside the div class using jquery

<div class="row">
<div id ="1">Here is content</div>
<div id ="2">Here is content</div>
<div id ="3">Here is content</div>
<button id ="remove">

I want to remove the row form last(3 ,2 ,1) on clicking button using j query please suggest me a code.

Answer Source

When you click remove button ,get the class row and you want to delete its children so use children() .Can remove last index by last() function and remove().

$('#remove').click(function() {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download