简体   繁体   中英

jQuery only possible to execute once per page load

My jQuery script is a popup window to my website when you click a button. The buttons are in table, in a foreach loop. Things works just fine there. The problem is, if i click product 1, the popup window works as it should, but when i close the window and try to popup it again, it not works. It will work again if refresh the page. It seems to work only once per button, then i need to refresh page..

The jQuery script is here:

;
            (function ($) {
                // DOM Ready
                $(function () {
                    // Binding a click event
                    // From jQuery v.1.7.0 use .on() instead of .bind()
                    $('.wiki-button').bind('click', function(e){
                    var $tr = $(e.currentTarget).closest('tr'), 
                    $content = $tr.find('#wiki-content');
                    $content.bPopup();
                    });
                });
            })(jQuery);

Thanks in advance :)

EDIT:

Thanks a lot for all answers. The rest of code can you look at this pastebin code! Pastebin

使用以下

$(document).on('click','.wiki-button', function(e){

I think you are repeating the id

Sorry to add as answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM