In this tutorial, learn how jQuery remove anchor tag link from div on button click. The Short answer is: use the find() to find the anchor link and unwrap() to remove the link on click of the button.

The link contains some text and is inside the div element. You can remove the anchor tag from the text and the text is not changed. You have to first find the anchor tag using the find().

The content() find the content inside the anchor tag and the unwrap() remove the anchor tag from the content.

How jQuery Remove Anchor Tag Link

To perform this task on click of the button, you have to use the jQuery click event. You have to use the jQuery selectors to access the button element for click event and find the anchor link using the find().

You have to use find(), contents() and unwrap() together to jQuery remove anchor tag link.

Output


The above example contains the two links and a button. Click the link given above to jQuery remove anchor tag link and the text remains present there with no anchor link with it.

Hope, you like the tutorial on how to jQuery remove anchor tag link from div using jQuery. If you have any query regarding this tutorial, please comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.