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>

7th Oct 2019, 2:21 PM
Uzair Malim
Uzair Malim - avatar
3 Answers
+ 1
Use document.querySelector() to reference the div and the span it contain. document.querySelector("#myid.myclass span").innerText = "Replacement text";
7th Oct 2019, 2:41 PM
Ipang
0
Attr jquery
16th Oct 2019, 10:04 AM
Yair
Yair - avatar
0
$('myid').attr('class', fontChange);
16th Oct 2019, 10:06 AM
Yair
Yair - avatar