0
How to replace text inside specific class or id.
Hi, how can i replace a text inside specific class or id? For example <div id="myid" class="myclass"> <span> Text i want to replace </span> </div>
3 Answers
+ 1
Use document.querySelector() to reference the div and the span it contain.
document.querySelector("#myid.myclass span").innerText = "Replacement text";
0
Attr jquery
0
$('myid').attr('class', fontChange);