Apply styles to variables in template literals in JavaScript
P粉063039990
P粉063039990 2024-03-31 12:07:37
0
1
309

make ${text}bold

I'm trying to apply styles to TEXT inside the backtick operator.

P粉063039990
P粉063039990

reply all(1)
P粉296080076

Insert style in backticks

const content = document.getElementById('content')
var text = 'text'
content.innerHTML = `make ${text} bold`
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!