Hi,

I've run into the same problem of needing to bind events to elements
loaded remotely.  Rather than doing this manually in the OnOpen I've
modified jqModal a bit so that jqm() supports a third, onLoad()
callback so I can do:


****************
$('#loginBox').jqm(
  {ajax: some_url, trigger: 'trigger'},
  false,
  false,
  function(h) { $("#my_button", h.w).bind("click", my_handler); }
);
****************

Is this something that could be added to jqModal?

If anyone is interested the patched jqModal can be grabbed at
http://gigs.cx/jqModal.js


On 2/19/07, fatjoez <[EMAIL PROTECTED]> wrote:
>
> Hey brice.
>
> as per your suggestion A here lies my new document.ready code. Dodgy results
> though, no luck!
>
> =========
>
>
> $(document).ready(function() {
>
>         $('#inline').jqm();
>         $('#loginBox').jqm({ajax: 'login.htm', trigger: 'a.openLogin'});
>
>         function clickSetup(){
>
>                         $("#status").text('<span class="green">Login 
> Successful, Welcome');
>
>                 myusername   = $('[EMAIL PROTECTED]').get(0).value;
>         mypassword = $('[EMAIL PROTECTED]').get(0).value;
>                 $.ajax({
>                         url: "process.php",
>                         type: "POST",
>                         data: $.param( {user:myusername,pass:mypassword} ),
>
>                         success: function(msg){
>                                 if (msg != 'fail') { $("#status").text('<span 
> class="green">Login
> Successful, Welcome' + msg);
>                                         
> setTimeout(function(){$(".jqmClose").click();},1000);
>                                 } else { $("#status").text("<span 
> class='red'>Login Unsuccessful -
> Double check email/password</span>"); }
>                         }
>                 });
>         }
>         $('.loginBtn').click(clickSetup());
>
>         var onOpen = function(h) {
>         h.w.load('login.htm',function() {
>           $('.loginBtn',this).click(clickSetup());
>           // note; the $('.loginBtn') selector is scoped to $('#loginBox')
> via "this"
>         });
> };
>
> $('#loginBox').jqm({trigger: 'a.openLogin'},onOpen);
> });
>
> =========
>
>
>
> Brice Burgess wrote:
> >
> > fatjoez wrote:
> >> Problem is, the externally linked login box even though EXACT same code
> >> as
> >> inline, when attempting to submit via the submit button, the associated
> >> function in document ready is not launched. So basically when launching
> >> the
> >> external AJAX requested login page, the submit button in it no longer
> >> works.
> >>
> > fatjoez,
> >
>
> --
> View this message in context: 
> http://www.nabble.com/jqModal%3A-closeClass-and-href--tf3245957.html#a9040482
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to