Reputation: 1049
What I'm triying to accomplish is that everything there's a p tag with word "border" on it it will remove the text inside it (the word border) and add a class to the P. So far this works for finding the p and adding the class. How can I remove the text?
$('#main-body-content').find('p').filter(':contains(border)').addClass("border");
Upvotes: 1
Views: 1030
Reputation: 7550
try this
// find all divs that have attribute class
$('p').filter(function() { return $(this).attr('class'); }).each(function() {
$(this).html('');
});
Upvotes: 0