SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: button tag

  1. #1
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    button tag

    I read somewhere recently that the button tag was improved and more semantically correct than input type="submit". I like that it's easy to specify a key/value pair separate from what's actually displayed on the button. However, I noticed on w3schools that in IE, the contents of the tag will be submitted, rather than the value attribute. Which should I use? Should I go back to my old name="action[value]" trick? IE:

    HTML Code:
    <button type="submit" name="action" value="Save">Save Page</button>
    vs
    HTML Code:
    <input type="submit" name="action[save]" value="Save Page" />

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <button> is not more semantically correct than <input>. They are equally semantic, just with slightly different purposes.

    A <button> can have richer content – even block-level elements! – but it's not as well supported as <input>. Especially in IE.

    Use <input type="submit"> when you can, and <button type="submit"> when you have to. That's my advice (which I live by, myself).
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Tommy. I found a pretty neat presentation you might find of interest
    http://nickcowie.com/presentation/s5-button.html

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2009
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use <input type="submit">, do not use <button>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •