...

View Full Version : Difference between <input type='button' /> and <input type='submit' />



vikram1vicky
06-11-2012, 02:33 PM
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....

Will Bontrager
06-11-2012, 02:37 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum