嗨,下面我有一个提交按钮和点击提交按钮时执行的jquery功能:
<p><input id="submitBtn" name="submitDetails" type="submit" value="Submit Details" onClick="return myClickHandler();" /></p>
<script type="text/javascript">
function myClickHandler()
{
if (validation())
{
showConfirm();
return true;
}
return false;
}
</script>
Run Code Online (Sandbox Code Playgroud)
现在您可以看到是否满足validation()函数,然后它将执行showConfirm()函数,此函数将执行以下确认框:
function showConfirm()
{
var confirmMsg=confirm("Make sure that your details are correct, once you proceed after this stage you would not be able to go back and change any details towards Questions, Options and Answers for your Assessment." + "\n" + "\n" + "Are you sure you want to Proceed?" + "\n" );
if …Run Code Online (Sandbox Code Playgroud) jquery ×1