Javascript DOM HTML Meter Object create

Introduction

We can create a <meter> element via the document.createElement() method:

var x = document.createElement("METER");

Click the button to create a METER element with a specified value.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {/*from   ww  w . j  a v a  2s  .co  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>



PreviousNext

Related