Create an Italic Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Italic


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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create an I element with some text</button>

function myFunction() {/*  w  w w .  j a  v  a  2 s .  c om*/
    var x = document.createElement("I");
    var t = document.createTextNode("Some italic text");


Related Tutorials