Q:

How to submit a fancybox form?

I am using fancybox to open submitted form like this:
<form name="form" id="myForm" action="{$smarty.server.PHP_SELF}?action=abc" method="post" target="iframe" onsubmit="document.getElementById('iframe').src='{$smarty.server.PHP_SELF}?action=abc';">    
<input type="hidden" name="xyz" value="123">
<input type="submit" value="REGISTER" id="button" class="button">
</form> 

                $("#button").click(function() {                                            
                $("#iframe").fancybox({
                'titlePosition'     : 'inside',
                'transitionIn'      : 'fadeIn',
                'transitionOut'     : 'fadeOut'
                }).click();                            
            });

with <input type="submit" value="REGISTER" id="button" class="button"> everything is 
working fine. but for some reason i need to use <a href="">REGISTER</a>. So I tried
<a href="#" onclick="document.getElementById('myForm').submit();">REGISTER</a>

&
<a href="javascript:document.form.submit();">REGISTER</a>

In above cases fancybox is popping out but my form is not getting submitted.
How do I submit my form successfully within click function?

A:

Create your link like this:
<a href="#" id="submit_link">REGISTER</a>

And use this code:
$(function(){
  $('#submit_link').click(function(){
    $('#myForm').submit();
    return false;
  });
});

