# Element “input” with attribute “type” whose value is “button” must have non-empty attribute “value”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/element-input-with-attribute-type-whose-value-is-button-must-have-non-empty-attribute-value
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

An `<input type="button">` element requires a non-empty `value` attribute because that attribute provides the button's visible label and its accessible name.

Unlike `<input type="submit">`, which defaults to a browser-provided label like "Submit", `<input type="button">` has no default label. Without a `value`, the button renders as an empty rectangle with no text, and assistive technologies have nothing to announce to the user. The W3C validator flags this as an error because the HTML specification mandates that `<input type="button">` must have a `value` attribute, and it must not be empty.

If you need a button without visible text (for example, an icon-only button), use a `<button>` element instead. The `<button>` element can contain child elements like `<img>` or `<span>`, and you can give it an accessible name through `aria-label` or visually hidden text. The `<input>` element cannot contain child content, so `value` is its only mechanism for labeling.

## Invalid example

```html
<input type="button" onclick="doSomething()">
```

## Valid examples

Add a non-empty `value` attribute:

```html
<input type="button" value="Click me" onclick="doSomething()">
```

Or switch to a `<button>` element, which is more flexible:

```html
<button type="button" onclick="doSomething()">Click me</button>
```
