Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input type button - label vs value

Tags:

html

I think that the normal behavior of a button like the one below is that the value attribute serves as a label as well:

<input type="submit" name="submitButton" value="DeleteAnswer22" /> 

Is it possible to have separate attributes for display label and value?

like image 544
user441365 Avatar asked Apr 18 '11 10:04

user441365


People also ask

Should I use button or input type button?

The difference is that <button> can have content, whereas <input> cannot (it is a null element). While the button-text of an <input> can be specified, you cannot add markup to the text or insert a picture.

What is the difference between input type button and button tag?

In HTML, <input type="button" /> is used to create buttons in an HTML form. Inside the <button> tag, you can place content like text or images. But, this is not the case with the buttons created with <input> tag.

Does button tag have value?

The value attribute specifies the initial value for a <button> in an HTML form. Note: In a form, the button and its value is only submitted if the button itself was used to submit the form.

Can buttons have value names?

The name attribute of the <button> element is used to set the name for a button. More than one button can have the same name, but we can submit different values from these buttons using the name attribute.


1 Answers

Use the HTML Button element, with type submit, instead:

<button type="submit" name="submitButton" value="DeleteAnswer22">Delete Answer 22</button> 

This will result in a submit button that sends the value DeleteAnswer22 but displays "Delete Answer 22".

like image 162
Jonathan Avatar answered Oct 22 '22 04:10

Jonathan