Get Emphasized Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Emphasized

Introduction

The Emphasized object represents an HTML <em> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<em id="myEm">this emphasized text</em>

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

<script>
function myFunction() {/*from w w w  .  j a  va  2s  . co m*/
    var x = document.getElementById("myEm");
    x.style.color = "red";
}
</script>

</body>
</html>

Related Tutorials