How can I remove the following tag with jquery?
<p align="center">Click here <a href="http://www.domain.com/" target="_blank">My domain</a></p>
jQuery('<p align="center">Click here <a href="http://www.domain.com/" target="_blank">My domain</a></p>').replaceWith('');
but it does not work
Just do something to target that p and remove it.
With that small snippet I can't tell you exactly, but something like:
would do the trick.
The remove function removes anything in the list, so you just have to get that p in it's list and call remove. Just be careful of removing too much (for example, don't use that exact code because it'll remove every p).
I understand. p tag does not have class
Won't this code jQuery('p').remove() remove all p tags from html?
Yes. You'll need something in one of the attributes of the tag that will identify the specific tag if you want to just remove that one.
Yeah, like I said, just 'p' will remove everything.
With that little snippet of code I can't help you narrow it down any more.
If you give us a larger chunk of code we probably can help you though.