Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <script src="https://code.jquery.com/jquery-3.5.0.min.js"></script> <style> span.change:after { content: attr(data-content) ' to W3Docs!'; } </style> </head> <body> <p>Hover over Wel</p> <span>Wel</span> <script> $(document).ready(function() { $('span').hover(function() { $(this).addClass('change').attr('data-content', 'come'); }); }); </script> </body> </html>