Create a Meter Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Meter

Introduction

You can create a <meter> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">create a METER element with a specified value</button>

<script>
function myFunction() {/*from   ww  w.  j a va2s  .  c o  m*/
    var x = document.createElement("METER");
    x.setAttribute("min", "0");
    x.setAttribute("max", "100");
    x.setAttribute("value", "65");
    document.body.appendChild(x);
}
</script>
</body>
</html>

Related Tutorials