button autofocus Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:button

Description

The autofocus attribute is a boolean attribute to set if a button should automatically get focus when the page loads.

A button with autofocus:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button type="button" autofocus onclick="console.log('Hello world!')">Click Me!</button>

</body><!--   w w  w. java 2s .co m-->
</html>

Related Tutorials