EN
HTML - button input
3 points
In this article, we would like to show you how to use button input in HTML.
Quick solution:
xxxxxxxxxx
1
<input type="button" value="Click me!" onclick="myFunction()" />
or equivalent:
xxxxxxxxxx
1
<button onclick="myFunction()">Click me!</button>
In this example, we create a button using HTML input
element (type
attribute set to button
).
xxxxxxxxxx
1
2
<html>
3
<head>
4
<script>
5
6
const myFunction = () => {
7
console.log("Button clicked ...");
8
};
9
10
</script>
11
</head>
12
<body>
13
<input type="button" value="Click me!" onclick="myFunction()" />
14
</body>
15
</html>