How to make a glyphicon work as a submit button?

Raviteja picture Raviteja · Dec 7, 2015 · Viewed 30.8k times · Source

I have a button of type Submit with text as edit for POST method in asp.net HTML.BeginForm.I want to replace it with a glyphicon-edit.How to achieve the same functionality as input.I am able to achieve the functionality using Edit button.I want the same functionality using glyphicon-edit

HTML

<br />

<input type="submit" class="btn btn-default" name="Editing" value="Edit" />

<div class="circle">
  <div class="glyphicon glyphicon-edit"></div>
</div>

CSS and Look of glyphicon-edit is included in a fiddle here

Answer

Suman KC picture Suman KC · Dec 7, 2015

You can write a button with a type submit and wrap an glyphicon inside

<button type="submit">
   <span class="glyphicon glyphicon-edit"></span>
</button>

Edit :

  • The button style will applied to glyphicon, but you can remote the default button css properties (for eg. background:none;border:none;padding:0;) and apply new style
  • onclick border appears ? - outline:none should solve the outline border issue onclick.