[html] Change text from "Submit" on input tag

I have a tag, <input type="submit" class="like"/>. I want to have the text inside the button say "Like", but right now, it says "Submit".

class="like" is the CSS of the button, by the way.

This question is related to html

The answer is


The value attribute on submit-type <input> elements controls the text displayed.

<input type="submit" class="like" value="Like" />

<input name="submitBnt" type="submit" value="like"/>

name is useful when using $_POST in php and also in javascript as document.getElementByName('submitBnt'). Also you can use name as a CS selector like input[name="submitBnt"]; Hope this helps


The value attribute is used to determine the rendered label of a submit input.

<input type="submit" class="like" value="Like" />

Note that if the control is successful (this one won't be as it has no name) this will also be the submitted value for it.

To have a different submitted value and label you need to use a button element, in which the textNode inside the element determines the label. You can include other elements (including <img> here).

<button type="submit" class="like" name="foo" value="bar">Like</button>

Note that support for <button> is dodgy in older versions of Internet Explorer.