HTML JS REPLACE

Javascript replace text function

Ho do I change color, font-size, font and such? I need to link my script like this, can’t use < otherwise:

 
window.onload = function() < document.body.innerHTML = document.body.innerHTML.replace(/Deckling/g, result); >var str = "The Liberator"; var result = str.fontcolor("Red").italics().fontsize(6); result.style.fontFamily = "Harrington"; 

3 Answers 3

You can wrap you text in a div or span tag, select it in JS applying a class.

The class will contains the style for your text.

Just a quick example in vanilla javaScript (no jquery): http://jsbin.com/yufiteseme/1/

     
Читайте также:  Python open and create file
Оцените статью