Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to set a type on buttons

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 225
    Comment on it

    The default value is submit, meaning any button in a form can submit the form. Use type="button" for anything that doesn't submit the form and type="submit" for those that do.

    <button type="submit">Save changes</button>
    <button type="button">Cancel</button>
    

    For actions that require a <button> and are not in a form, use the type="button".

    <button class="dismiss" type="button">x</button>
    

    As far as one knows, the value attribute on <button>s are not supported by IE7, it pulls from the innerHTML (the content between the opening and closing <button> tags) inplace of reading the attribute's content.

    According to me we don't need to bother about this because of the two reasons: IE7 usage is way down, and it seems rather uncommon to set both a value and the innerHTML on <button>s.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: