Get Italic Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Italic

Introduction

The Italic object represents an HTML <i> element.

You can access an <i> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<i id="myItalic">this italic text</i>

<button onclick="myFunction()">set the color</button>

<script>
function myFunction() {//from  www  .  java  2s  . c o  m
    var x = document.getElementById("myItalic");
    x.style.color = "red";
}
</script>

</body>
</html>

Related Tutorials