-1

COUNTER COUNTER EDIT:

Sorry for obvious question, my edits keep getting deleted but was just saying been working non stop and had a complete blank when trying to remember this, thanks to the Stack community though!

I have my HTML here:

<input type="submit" name="buddy1" value="Yes" placeholder="Toggle Yes">

I want the input value to be Yes but the text displayed to be "Toggle Yes". I know there's a trick with span classes and buttons but I want the button to also be the submit. Is there a quick way of doing this WITHOUT Javascript?

James V
  • 60
  • 1
  • 7
  • 1
    I don't understand you question that well. So you want an input that always displays *Toggle* followed by an input? Why not using a label? – lumio Aug 31 '17 at 19:16
  • 1
    The placeholder attribute on an input with type submit is invalid – j08691 Aug 31 '17 at 19:18
  • duplicate of: https://stackoverflow.com/questions/4171664/html-submit-button-different-value-button-text – stephen.vakil Aug 31 '17 at 19:18

2 Answers2

3

You can use the <button></button> instead:

<button type="submit" name="buddy1" value="Yes">Toggle Yes</button>

Mike S
  • 1,636
  • 7
  • 11
  • Thank you perfect, knew I was being stupid. I am good at this I promise just soo soooo tired I can't think straight. Appreciate the help buddy!! – James V Aug 31 '17 at 19:19
1

Your should use a button element, where you can change the text of the button. Buttons elements are just input elements which have more options. From the w3 site on button:

Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities:

For example. <button type="submit" name="buddy1" value="Yes">Toggle Yes</button>

Pim
  • 850
  • 7
  • 17