Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put HTML into submit button's value

I have a submit button that is used to save a form. Inside the submit button I want to use a HTML tag. I am using Font Awesome and I would like the save icon to appear next to the word save in the button. The HTML for this is

<i class="icon-save"></i> Save

The only problem is I cannot seem to get HTML to render inside the value="" property on the submit button. How can I get HTML to render inside the submit button? This doesn't parse the HTML, it actually renders a button with the literal contents

<input type="submit" value="<i class='icon-save'></i> Save" />

Here is an example of what I want

like image 741
Chris Avatar asked Dec 06 '12 11:12

Chris


People also ask

How do you submit a value in HTML?

Definition and Usage The <input type="submit"> defines a submit button which submits all form values to a form-handler. The form-handler is typically a server page with a script for processing the input data. The form-handler is specified in the form's action attribute.

Can I use a tag as submit button?

To use the anchor tag as submit button, we need the help of JavaScript. To submit the form, we use JavaScript . submit() function. The function submits the form.

How Add URL in submit button?

To Link HTML Input type submit to another page using HTML Form tags, we have to declare/write our HTML input type submit button between HTML Form Tag's Starting and Closing Tags. In HTML Form tag's Action attribute, we have to give our Another Web page's link (Where we want to Link out Input type submit Button).

Can you give a button a value HTML?

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.


1 Answers

did you try the button tag like this :

<button type="submit">
   <i class='icon-save'></i> Save
</button>
like image 121
Justin T. Avatar answered Sep 30 '22 21:09

Justin T.