Im trying to find all p tags with inline style attrs style=”text-align:center;” that contain just and nothing else. And then removing the entire p for each found.
There are other p tags with the same attr that contain more than just nbsp which I want to keep, Im just stuck on finding the ones with a space only. Stupid wordpress tinyMCE editor, drives me nuts.
This is the base of what i was working on doing it with. just outputs all the text-align center p tags.
var p = $('.entry p[style="text-align: center;"]');
p.each(function() {
console.log(p);
});
Stupid little thing, i dont want to spend anymore time trying to figure out what im doing wrong. Here’s an example page that has the stuff im working with.
http://www.drinkinginamerica.com/page/14/
Thanks
You can do this with the
remove()function:See http://jsfiddle.net/nrabinowitz/LJHyA/ for a working example. This assumes a pretty strict case in which the only thing in the
ptag is the entity.Too slow – @mu wins.