Get Article Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Article

Introduction

The Article object represents an HTML <article> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<article id="myArticle">
  <h1>Article Heading</h1>
  <p>Some article text..</p>
</article>/*  w w  w  .j a v  a  2s.c  o m*/

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

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

</body>
</html>

Related Tutorials