Reputation: 2333
For example, I have such line:
$('div#about_title:after').remove();
And it doesn't seem to work, how I can do this?
Upvotes: 2
Views: 151
Reputation:
You can not use because after you're already taking element by id and id corresponds to only one element then why would not need to put after
$('div#about_title').remove();
Upvotes: 0
Reputation: 46647
Psuedo-elements created by :before
and :after
do not technically exist on the DOM, so they can not be manipulated by javascript (and consequently jQuery).
You can edit the CSS to remove them:
<div class="afterStuff"></div>
div.afterStuff:after {
content: "hi";
}
$('.afterStuff').removeClass('afterStuff');
I would recommend adding/removing classes over directly modifying inline styling.
Upvotes: 2