pedroz — 2011-03-14T15:13:47-04:00 — #1
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
samanime — 2011-03-14T16:02:50-04:00 — #2
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).
pedroz — 2011-03-14T16:11:42-04:00 — #3
I understand. p tag does not have class
Won't this code jQuery('p').remove() remove all p tags from html?
felgall — 2011-03-14T16:48:18-04:00 — #4
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.
samanime — 2011-03-14T22:58:53-04:00 — #5
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.