jquery click on href link - have to click twice
问题 The function works, but the popup will open only after the button is clicked twice (and then, subsequent clicks get the action on the first click). $(document).ready(function(){ $('a#printPosBtn').on('click', function(e) { e.preventDefault(); $('.printPopup').popupWindow({ centerBrowser:1, height:500, width:720, scrollbars: 1, resizable: 1 }); return false; }); }); What's wrong? 回答1: I think that is because you are actually initialising the plugin within the click handler. From a quick skim