Changing pseudo-element content using JavaScript

Developer
Size
2,042 Kb
Views
10,120

How do I make an changing pseudo-element content using javascript?

What is a changing pseudo-element content using javascript? How do you make a changing pseudo-element content using javascript? This script and codes were developed by Felquis on 08 December 2022, Thursday.

Changing pseudo-element content using JavaScript Previews

Changing pseudo-element content using JavaScript - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Changing pseudo-element content using JavaScript</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <span data-content="Something is happening">Something is happening</span> <script src="js/index.js"></script>
</body>
</html>

Changing pseudo-element content using JavaScript - Script Codes CSS Codes

span {	position: relative;	display: block;	padding: 20px 0 0 0;
}
span:before {	content: attr(data-content); position: absolute; top: 0; left: 0; color: gray;
}

Changing pseudo-element content using JavaScript - Script Codes JS Codes

'use strict';
var span = document.querySelector('span'), string = 'Yay';
span.dataset.content = 'Posso alterar usando o dataset';
setTimeout(function () { span.setAttribute('data-content', 'Ou posso usar o .setAttribute também');
}, 2000);
Changing pseudo-element content using JavaScript - Script Codes
Changing pseudo-element content using JavaScript - Script Codes
Home Page Home
Developer Felquis
Username felquis
Uploaded December 08, 2022
Rating 3
Size 2,042 Kb
Views 10,120
Do you need developer help for Changing pseudo-element content using JavaScript?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Felquis (felquis) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!