Get Emphasized Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Emphasized


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>

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

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

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


Related Tutorials