As part of a uni project I'm building a site that includes the use of forms.
What I HAVE to do is include a clear button which when clicked upon confirms if the user wishes to remove all entered info from within the form (prior to its submission - i.e. if they make a typo in multiple fields and wish to re-enter from the beginning).
I know how to do this without the pop-up message, but not with it.
Any help would be much appreciated.
Below are snippets of my code:
CODE*within the body*
*within the head*
function msg()
{
ÂÂÂÂvar ask = confirm('Clear the form?');
ÂÂÂÂ
ÂÂÂÂif (ask)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂ
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂelse
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂalert('OK, Nothing will be removed.');
ÂÂÂÂ}
}
* edit - I have also tried setting the input type to "reset"
What I HAVE to do is include a clear button which when clicked upon confirms if the user wishes to remove all entered info from within the form (prior to its submission - i.e. if they make a typo in multiple fields and wish to re-enter from the beginning).
I know how to do this without the pop-up message, but not with it.
Any help would be much appreciated.
Below are snippets of my code:
CODE*within the body*
*within the head*
function msg()
{
ÂÂÂÂvar ask = confirm('Clear the form?');
ÂÂÂÂ
ÂÂÂÂif (ask)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂ
ÂÂÂÂ}
ÂÂÂÂ
ÂÂÂÂelse
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂalert('OK, Nothing will be removed.');
ÂÂÂÂ}
}
* edit - I have also tried setting the input type to "reset"