Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    <button type="button">Click Me!</button>

    Are there other button types besides this default one? If there is only one type of button then why add the <button type="button"> why not just <button>?

  • #2
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    The <button> element doesn't need a "type=" attribute.

    The <input> element needs a type attribute if it is to be a button <input type="button" name="myButton" value="Click me.!" />

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by Darqniz View Post
    Are there other button types besides this default one? If there is only one type of button then why add the <button type="button"> why not just <button>?
    Quote Originally Posted by bullant View Post
    The <button> element doesn't need a "type=" attribute.

    The <input> element needs a type attribute if it is to be a button <input type="button" name="myButton" value="Click me.!" />
    Yes, it has!
    Read http://htmldog.com/reference/htmltags/button/
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by abduraooft View Post
    Yes, it has!
    "Yes, it has", what?

    The type attribute is optional for the <button> element.

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by bullant View Post
    "Yes, it has", what?

    The type attribute is optional for the <button> element.
    May be, but OP asked
    Are there other button types besides this default one?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    and I replied with

    Quote Originally Posted by bullant View Post
    The <input> element needs a type attribute if it is to be a button <input type="button" name="myButton" value="Click me.!" />
    I'm not sure what the "it" is that you say "has" something. But never mind, it's not important.

  • #7
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by bullant View Post
    and I replied with



    I'm not sure what the "it" is that you say "has" something. But never mind, it's not important.
    But the OP didn't ask about <input>. Why are you mixing the original question with the characteristic of an <input> element?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #8
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    I don't think I'm mixing up anything.

    The op asked

    Are there other button types besides this default one?
    and the answer is yes - an input button.

  • #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,638
    Thanks
    6
    Thanked 1,004 Times in 977 Posts
    Bullant, I think you’re a little picky here. The OP meant to ask if there are other values for the type attribute of the button element. And there are, for example <button type="submit"></button>.

  • #10
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by VIPStephan View Post
    The OP meant to ask if there are other values for the type attribute of the button element. And there are, for example <button type="submit"></button>.
    I don't know what the op really meant to ask because their question as worded is ambiguous, so I answered according to what I thought the op asked.

  • #11
    New Coder
    Join Date
    Jan 2011
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Bullant, I think you’re a little picky here. The OP meant to ask if there are other values for the type attribute of the button element. And there are, for example <button type="submit"></button>.
    Yep and sorry for the confusion.

  • #12
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Darqniz View Post
    Yep and sorry for the confusion.
    no problem, no harm done

  • #13
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by Darqniz View Post
    Are there other button types besides this default one? If there is only one type of button then why add the <button type="button"> why not just <button>?
    The type attribute specifies the element's behavior when it appears inside a form element. As already mentioned, there are three values that specify different behaviors.

    When the button element appears inside a form element, type="button" has no default behavior and essentially does nothing unless scripted events are tied to it; type="submit" submits the form (by default, form information is submitted to the location specified in the form element's action attribute); and type="reset" resets the form to its default state. (type="reset" is generally misunderstood and rarely used properly; it's supposed to be used for forms that are submitted multiple times with different data (like you would do when entering records into a database).)

    Outside of a form element, all three type values (i.e., button, submit, and reset) behave like button. (That should make sense since there's nothing to submit or reset.)
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

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