BR
asked on
javascript form submition
Dear Experts,
I use a javascript to ask the user 'Are you sure?' before they submit the form
Below code works fine when my user clicks the submit button. But I want it to work just before the form is submitted. ( not onclick )
How can I do that? ( I know that I should use it on the <form tag like onSubmit but I couldn't manage it)
I use a javascript to ask the user 'Are you sure?' before they submit the form
Below code works fine when my user clicks the submit button. But I want it to work just before the form is submitted. ( not onclick )
How can I do that? ( I know that I should use it on the <form tag like onSubmit but I couldn't manage it)
<input type="submit" name="submit" id="submit" value="Submit" onclick="clicked(event)">
<script>
function clicked(e)
{
if(!confirm('Are you Sure?'))e.preventDefault();
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER