This will highlight the first p element but if you have more than one it would be better to use an ID and find it by getElementById
p = document.getElementsByTagName('p');
p[0].style.background= 'yellow'
"<html>
<body>
<p style="width:30px;">Test</p>
</body>
</html>"
1
solved Given a string of html, how would i search and highlight a word?