-3

how can I remove an element using jquery by the text in the element.

<a href="/">Link1</a>

I dont want to remove the element by class or ID. I want to do something like this:

$('a').html('Link1').remove()

Can you help me with this?

Sergi Khizanishvili
  • 479
  • 1
  • 5
  • 15
  • 3
    ["Can someone help me?" is not an actual question](https://meta.stackoverflow.com/a/284237/162698) – Rob Aug 01 '18 at 19:57

1 Answers1

0

Please try this

jQuery

$('a:contains("Link1")').remove();

Demo fiddle

For more reference please refer this.

Rino Raj
  • 6,156
  • 2
  • 25
  • 39