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?
I think that is because you are actually initialising the plugin within the
clickhandler. From a quick skim through thepopupWindowdocs it appears that the plugin takes care of binding aclickhandler for you, which means that your first click binds the popup functionality (including an onclick handler) so it only works upon click a second time. I would try: