+ 1

color work on firefox but not work on chrome

i change color specific character by this regex. it work on firefox but not work on chrome? why? let n = n.replace(/(\u064D)/g, "<span class='redcolor'>$1</span>"); document.getElementById("divmain").innerHTML = n; css: .redcolor { color: red; }

30th Oct 2023, 3:55 AM
Hadi
Hadi - avatar
2 Respuestas
+ 5
Also it is possible that the problem is caused by how your code (particularly the JS) is organized. Maybe the chrome tries running the javascript when the html dom structure is not yet created. You can try binding the JS to the window.onload or document.onload event. It would be easier to analyse, seeing your complete code.
30th Oct 2023, 1:03 PM
Tibor Santa
Tibor Santa - avatar