Create a Mark Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Mark


You can create a <mark> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create a MARK element with some text</button>

function myFunction() {/*from  w  ww .  j a v a2s . co m*/
    var x = document.createElement("MARK");
    var t = document.createTextNode("Some marked text");


Related Tutorials