tags:

views:

69

answers:

3

How do I display text for a button without going between the <button></button> tags?

<button id="btnTest" >Need Text in button tag!</button>
+1  A: 

If you're doing it in ASP.net, use the asp button:

<asp:Button id="btnTest"
           Text="Need Text In button Tag"
           OnCommand="CommandBtn_Click" 
           runat="server"/>
Rob
He is using asp.net-mvc, as the tags suggest.
Oded
+3  A: 

I think you may have meant to ask for this :

<input type="submit" value="Text on button" />
<input type="button" value="And again" />
çağdaş
A: 

You should use the input tag. The benefit of this is that the value of the button is also passed to the server along with the the contents of the form. This way on the server you can determine which button was pressed on the form. So say for example, you had a submit and a delete button. They would both be inputs with a type of 'submit' but their values would differ and so when it posts back, you can check the value of btnSubmit

Just remember that

<input type="submit" id="btnSubmit" value="text here" />

and

<button type="submit" id="btnSubmit">text here</button>

will look different so you don't want to mix the two in the same form :)

soniiic