Validate on submit and on successful validation popup a confirm modal box using Jquery

Viewed 60

I have a submit button and on its click, both validation and confirm box pop up are happening at the same time. Is there any way where on click, it validates first and on its success confirm modal box appears.

Note that I'm using the following for confirmation box

$("#submit").modalconfirm({
afterconfirm:function{
$(this).parents("form").submit;}
}); 

Validations are being done using '.validate'

And the following to validate on click of submit

$("#submit").click(function(){
$("#form").valid();
}

And the following in HTML

Inside a div:

<button id="submit" class="" data-confirmation-content="#some"> Submit</button>

After the div:

<div id="some" title"confirmation">
<p> Are you sure? </p>
</div>

I've also tried another way including a new modal with class modal fade and modal-header,body,footer and implemented submit handler in the js but after validation when I click on submit the screen is being blurred out but the confirm dialog box is not appearing.

0 Answers
Related