Value="" help, getting two different actions

Hi guys,

< input type=“submit” value=“Press me!”> changes the button to say “Press me!”
But
< input type=“radio” name=“animal” value=“cat”>cat registers the value as ‘cat’ once I’ve submitted the form.

Why do two things different things happen with value=""? (I’m just messing with forms atm)

Just checking out w3schools
“For , and elements, the value attribute specifies the initial value of the element.?” Still a bit confused

Thank you.

Not sure what answer you are looking for, but the short answer is because that is what the specs says.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/button#Value
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio#Value

1 Like

Thank you, so I’m assuming it’s just a different action depending on the input type.

Yes, the value attribute is just used differently depending on the input type.

You can’t really get a value from a button so it makes some sense to use the value as the text content for the button. For other input elements, the value is in relation to the “state” of the input and the input type.

1 Like

Awesome, thanks for this. :slight_smile: