How to manipulate CSS pseudo-elements ::before and ::after using jQuery?

To manipulate CSS pseudo elements using the hover() function. You can try to run the following code to learn how to manipulate CSS pseudo-elements −


Live Demo

<!DOCTYPE html>
<script src=""></script>
span.change:after {
    content: attr(data-content) ' This is demo text.';
<p>Place cursor below...</p>


Updated on: 15-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started