95

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?

pb2q
  • 58,613
  • 19
  • 146
  • 147
user441365
  • 3,934
  • 11
  • 43
  • 62
  • Possible duplicate of [HTML Submit-button: Different value / button-text?](http://stackoverflow.com/questions/4171664/html-submit-button-different-value-button-text) – Organic Advocate Feb 02 '16 at 22:57

1 Answers1

158

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".

Wilson F
  • 1,250
  • 1
  • 20
  • 37
Jonathan
  • 7,536
  • 4
  • 30
  • 44
  • 3
    This solution may have problems with some browsers. see https://stackoverflow.com/questions/13134631/button-text-different-than-value-submitted-in-query-string – Murat Tutumlu Sep 28 '17 at 03:10
  • @MuratTutumlu do you know if these problems are still relevant? The information that post refers to no longer exists. – David Cook Oct 27 '21 at 04:14