Get Kbd Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Kbd

Introduction

The Kbd object represents an HTML <kbd> element.

You can access a <kbd> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<kbd id="myKbd">Keyboard input</kbd>

<button onclick="myFunction()">set the color of the kbd element</button>

<script>
function myFunction() {/*  ww w . jav a  2  s . c  o  m*/
    var x = document.getElementById("myKbd");
    x.style.color = "red";
}
</script>

</body>
</html>

Related Tutorials