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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts

    Question Difference between <input type='button' /> and <input type='submit' />

    Hi Buddies,

    Please let me know what's the difference between <input type='button' /> and <input type='submit' /> .

    When we click on submit, the content of <input type="text" /> vanishes.

    But if we click on button, the content of <input type="text" /> remians there.


    Please give proper guidance on it

    Thanks in advance

    Cheers....

  • #2
    Regular Coder
    Join Date
    Jun 2012
    Location
    Near Chicago, USA
    Posts
    123
    Thanks
    7
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by vikram1vicky View Post
    Hi Buddies,

    Please let me know what's the difference between <input type='button' /> and <input type='submit' /> .

    When we click on submit, the content of <input type="text" /> vanishes.

    But if we click on button, the content of <input type="text" /> remians there.


    Please give proper guidance on it

    Thanks in advance

    Cheers....

    type="submit" submits the content of the form to the URL specified in the form tag. If no URL is specified, the content is submitted to the current page, causing a page reload. The page reload is likely the reason the type="text" field's value vanishes.

    type="button" is only a button. It doesn't do anything by itself other than change shading when it is clicked. An onclick="FunctionName()" attribute can be added to the type="button" field to run a JavaScript function when the button is clicked.

    Will


  •  

    Tags for this Thread

    Posting Permissions

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