How to remove elements using jquery? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to remove elements using jquery?

I want a simple demonstration of how to remove a button after it has been clicked using JQUERY.

19th Jul 2017, 12:20 AM
DeltaTick
DeltaTick - avatar
2 Answers
+ 3
//Combine Chaotic $('button').click(function(e){ this.remove();//Click then it's removed })
19th Jul 2017, 2:32 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
0
$("#elementid").remove(); $(".element-class").remove(); You can get the element(s) similar to the way you specify element(s) in CSS using the $() jQuery selector.
19th Jul 2017, 2:19 AM
ChaoticDawg
ChaoticDawg - avatar