Get Aside Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Aside

Introduction

The Aside object represents an HTML <aside> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>This is a test. This is a test. This is a test.This is a test. This is a test. This is a test.</p>

<aside id="myAside">
  <h4>header</h4>
  <p>this is aside. this is aside. this is aside. this is aside. this is aside. this is aside. </p>
</aside>//from ww w .jav a2  s .  co  m

<button onclick="myFunction()">set the text color of the aside content to red</button>

<script>
function myFunction() {
    var x = document.getElementById("myAside");
    x.style.color = "red";
    x.style.border = "1px red solid";
}
</script>

</body>
</html>

Related Tutorials