April 21, 2021

Remove() Function

This simple function is useful when you want to remove an element from the document.

Sample Query

$(".legal").remove();

This would remove any element that has the words "legal" in the class name.

This would be useful if you are taking screenshots and want to remove certain parts. Also useful for QA to test "hacking" functionality.

Fun Tricks to Try

Remove All Images

This removes all the images on the page:

$("img").remove();

Remove All Anchor

This removes all the anchor tags and text on the page:

$("a").remove();

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!