Javascript examples for DOM HTML Element:Span
Change CSS styling based on content words
<html> <head> <style> .big{ font-size: 55px; } </style> <script> function chng(){/*from www .j a v a 2s . c o m*/ var text = document.getElementById('pText').innerHTML; var text2 = text.replace('test','<span class="big">test</span>'); document.getElementById('pText').innerHTML = text2; } </script> </head> <body> <p id="pText"> this is a test </p> <button onclick="chng()">Try it</button> </body> </html>