jquery - Fancybox link not working with submit button -


okay, have fancybox, working, isn't working entirely properly. works in actual text-link, not when have on submit button. well, shouldn't doesn't work, rather works , fancybox closes automatically within under second, or lasts second if i'm lucky, never stays open (it stay open text link).

the fb code:

<script> $(document).ready(function() {  $("#top-login-button").click(function() {   $.fancybox({    padding    : 15,    href       : "#login_form_ajax",    afterclose : function(){ // onclosed v1.3.4     $("#login_error").hide();    }   }); // fancybox  }); //click   $("#login_form_ajax").bind("submit", function() {   if ($("#login_name").val().length < 1 || $("#login_pass").val().length < 1) {    $("#login_error").show();    $.fancybox.update(); // $.fancybox.resize(); v1.3.4    return false;   }   $.fancybox.showloading(); // $.fancybox.showactivity(); v1.3.4   $.ajax({    padding : 15,    type    : "post",    cache   : false,    url     : "anypage.php?page=ajax",    data    : $(this).serializearray(),    success: function(data) {     $.fancybox(data);    }   });   return false;  }); // bind }); // ready </script> 

the fancybox open links:

<a id="top-login-button" href="#login_form_ajax" rel="gallery">open login form</a> 

the above works. 1 below, works , closes automatically.

<a id="top-login-button" href="#login_form_ajax" style="text-decoration:none" title="x">   <input class="czas" type="submit" name="ajax" value="x"></a> 

any ideas? i'm @ loss.

modified jfk had stated original code was, end result, works perfectly:

<input class="czas" id="top-login-button" data-fancybox-href="#login_form_ajax" type="button" name="ajax" value="enter starting time"> 

don't know how thank jfk, since didn't post answer question...


Comments