How to update HTML text via javascript without distrubing css

i been using certain properties like innerText to update HTML text but for some reason CSS (font color, size etc) is not applying on those text. How to fix it?
6 Replies
vince
vince2y ago
Put it in a codepen; works fine for me.
Avinash
AvinashOP2y ago
im getting data from API will that cause and issue? think font size is 0.75rem , after updating its 1rem
vince
vince2y ago
Get rid of sup and the span surrounding both paragraphs. <span> is a generic container to wrap inline text Replace <span> with a p tag and it works
<div class="flex fd-column jokes">
<p>If a farmer raises wheat in dry weather, what does he raise in wet
weather?
</p>
<p class="joke-answer"> An umbrella. </p>
</div>
<div class="flex fd-column jokes">
<p>If a farmer raises wheat in dry weather, what does he raise in wet
weather?
</p>
<p class="joke-answer"> An umbrella. </p>
</div>
.joke-answer {
font-size: 0.75rem;
color: red;
}
.joke-answer {
font-size: 0.75rem;
color: red;
}
Avinash
AvinashOP2y ago
ok it worked thanks
Want results from more Discord servers?
Add your server