开发者

Adding button click event when Fancybox popup opened

开发者 https://www.devze.com 2023-01-01 00:59 出处:网络
I\'m trying to add a button onclick event to a button tag when I load my Fancybox popup using the following code:

I'm trying to add a button onclick event to a button tag when I load my Fancybox popup using the following code:

var processOrder = functio开发者_如何学Gon(id) {
    $('#processPopupLink').fancybox({
        'hideOnContentClick': false,
        'frameWidth': 850,
        'frameHeight': 695
    }).click();

    $('#processComplete').click(function() {
        alert('debug');
    });
}

However, it's not showing the message box when I click the button, I have no idea why it is not working, any help would be appreciated.

EDIT

I'm not wanting it to click the button, I'm wishing for it to add an onclick to an existing button on the fancybox popup, when the fancybox popup is opened.


From the Fancybox API:

onComplete - Will be called once the content is displayed.

$('#processPopupLink').fancybox({
    onComplete: function() { 
        $('#processComplete').click(function() 
            {
               alert('debug');
            }); 
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号