Input type button - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

A clickable button, that activates a JavaScript when it is clicked:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form>
  <input type="button" value="Click me" onclick="msg()">
</form><!--   w w  w  . j  a v  a2 s. com-->

<p>The button above activates a JavaScript when it is clicked.</p>

<script>
function msg() {
    console.log("Hello world!");
}
</script>

</body>
</html>

Related Tutorials