Click the button then pop up a dialogthen submit the button

<button onclick="productAddToCartForm.submit(this)" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>

the original js code:

var productAddToCartForm = new VarienForm('product_addtocart_form');
            productAddToCartForm.submit = function(){
                    if (this.validator.validate()) {
                            this.form.submit();
                    }
            }.bind(productAddToCartForm);

The above is the normal step. which is click the button, then submit the form. now, i want to add one step before the form is submitted. the step is. when click the button, it will pop up a dialog. there are some content on it. when close the dialog. then submit the form.

1, first i think i shoulf use jquery in

productAddToCartForm.submit = function(){....}

.if the page have loaded the jquery library.but i don’t know how to add jquery code in the function. thank you

pop up dialog effect

my test code, but it doesn’t work.

<div id="popup" style="display:none">
   <p>test</p>
    <a href="#" >test</a>

</div>

js code:

productAddToCartForm.submit = function(){
                        if (this.validator.validate()) {
                       $("#popup").show('slow', function() {
                       $('#popup').hide(1000,'slow', function() {
                      this.form.submit();
                       });
                       });
                      }
                    }
                }.bind(productAddToCartForm);

when i click the button, there is now show of the dialog. thank you

When I see this comment, I think that things are working for you.