Proper use of the <button> tag

travisowens

Well-known member
Joined
Feb 11, 2004
Messages
108
Location
Rochester, NY
I have a page where I have <button> tags and I simply wrap them inside <a href> but TIDY says this is not legit. Whats the correct way to do the following:

<a href="?action=go"><button>GO</button></a>

The W3C doesnt mention anything either: http://www.w3schools.com/tags/tag_button.asp

Technically, the traditional way to do this, which works fine but is very verbose is:

<form style="display: inline;"><input type="hidden" name="action" value="go"><input type="submit"></form>

but as you have more GET values to push, this gets very long (I already have 3 in my real code). Im just looking for a cleaner & more elegant way to achieve this.
 
Last edited by a moderator:
The following syntax is legit but it then the button no longer goes anywhere.

<button><a href="?action=go">GO</a></button>
 
Last edited by a moderator:
Back
Top