2 replies [Last post]
chris_sw
Offline
Enthusiast
Leeds, UK
Last seen: 15 years 17 weeks ago
Leeds, UK
Joined: 2004-09-21
Posts: 115
Points: 0

Hi

In another thread, someone found that applying style to a text input field affects all <input>s, be they text fields, submit buttons, radio buttons, checkboxes or hidden form fields. A while back, in response to problems like this, I changed all my

<input type="submit">Submit</input>

to

<button type="submit">Submit</button>

so I can style them seperately. I still have to explicitly class checkboxes, radios and hidden form items just so I can style the text fields cleanly but hey, it's one less.... also, I think it is a better semantic description of the element than an <input> tag, but I'm worried that there may be some problems with using this tag, seeing that almost all pages I look at use <input type="submit">

Does anyone else use or has tried <button>s? Is there any problems associated with them?

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 6 years 25 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

&lt;button type='submit'&gt; or &lt;input type='submit'&gt;?

Chris - from http://academ.hvcc.edu/~kantopet/ ...

The <button> tag allows you to perform most of the above [input] actions, the difference being that it provides greater flexibility. The <button> tag has an end tag, and any content between the tags becomes part of the button, i.e., clickable. The only content it cannot take is an imagemap. The <button> tag takes a type attribute that can have one of the three following values:

* <button type="submit">
* <button type="reset">
* <button type="button">

Other than that the button tag works like any other button.

Also, the W3C seems to think it's okay to use a button to submit a form. See > http://cita.rehab.uiuc.edu/wai-eval/show-test/index.php?test_id=91

Life's a b*tch and then you die!

chris_sw
Offline
Enthusiast
Leeds, UK
Last seen: 15 years 17 weeks ago
Leeds, UK
Joined: 2004-09-21
Posts: 115
Points: 0

&lt;button type='submit'&gt; or &lt;input type='submit'&gt;?

Excellent, cheers Roy. <button>s for me it is!