示例:$( '#button' ).click( function( e ) { //... your code... e.preventDefault(); return false;} );I wish to have a link which opens popup when clicked however I wish it to open a page in a new window if the user doesn't have JS enabled.The following doesn't seem to work,<a id="tac-link" target="_blank" href="tac.html">terms and conditions</a>function popUp(URL) {day = new Date();id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=600,left = 445,top = 150');"); }$('tac-link').click(function() { popUp('tac.html'); return false;}); 解决方案 In order to make this functionality more browser-compatible, you need to pass the event object to the click handler, then call e.preventDefault();.example:$( '#button' ).click( function( e ) { //... your code... e.preventDefault(); return false;} ); 这篇关于链接点击jQuery返回假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-26 15:14