html - How to change color with new tag in javascript? -


in html file have change color new tag.it changed permanently.if it's possible do.now using below code:

function alertselection() {       var range = window.getselection().getrangeat(0),       content = range.extractcontents(),       span = document.createelement('b');       span.appendchild(content);        var htmlcontent = span.innerhtml;        range.insertnode(span); } 

when press refresh old one.how create tag when selecting.

whenever want change style through use style

element.style.css attribue = value

example: span.style.color = "green";


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -