JSFiddle - React, Tailwind, and code Playground

by anthachetta

HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
    <div id="divMsg1">This is <i>just</i> a line</div>
    <br/><br/>
    <input type="button" value="Apply some style" onclick="ApplySomeStyle();" /><br />
</body>
</html>

JavaScript

function ApplySomeStyle() {
            var oDiv = document.getElementById("divMsg1");
            alert(oDiv.lastChild.previousSibling.firstChild.nodeValue); //I know this crazy. But for the knowledge sake                                            
            oDiv.lastChild.previousSibling.firstChild.nodeValue.style.color = "#FF0000";
        }