TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Jquery Delete All Table Rows Except First
Soumalya Das
Aug 12
2016
Code
2
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
HTML code
<
table
id
=
"tblGrid"
cellpadding
=
"10px"
cellspacing
=
"0"
border
=
"1"
>
<
tbody
>
<
tr
style
=
"background-color:black;color:white;font-size:18px;"
>
<
td
>
ID
</
td
>
<
td
>
Name
</
td
>
<
td
>
Location
</
td
>
<
td
>
Department
</
td
>
</
tr
>
</
tbody
>
<
tbody
>
<
tr
>
<
td
>
100
</
td
>
<
td
>
soumalya
</
td
>
<
td
>
kolkata
</
td
>
<
td
>
Accountant
</
td
>
</
tr
>
</
tbody
>
<
tbody
>
<
tr
>
<
td
>
101
</
td
>
<
td
>
rahul
</
td
>
<
td
>
dumdum
</
td
>
<
td
>
Management
</
td
>
</
tr
>
</
tbody
>
<
tbody
>
<
tr
>
<
td
>
102
</
td
>
<
td
>
suman
</
td
>
<
td
>
kulti
</
td
>
<
td
>
Accountant
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
button
id
=
"btndel"
onclick
=
"removerow()"
>
Remove row
</
button
>
Jqery code
function removerow()
{
$(
"#tblGrid"
).find(
"tr:gt(0)"
).remove();
}
Jquery
Delete Table Rows