Javascript DOM HTML Mark Object get

Introduction

The Mark object represents an HTML <mark> element.

We can access a <mark> element via document.getElementById():

var x = document.getElementById("myMark");

Click the button to set the font size of <mark> element to extra large.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {// ww w.  j  a  v a  2s.c om
  var x = document.getElementById("myMark");
  x.style.fontSize = "x-large";
}
</script>

</body>
</html>



PreviousNext

Related