Can I execute a link after a preventDefault()?
代码:
| 1 2 3 4 5 6 7 8 9 10 11 | $('#myLink').click(function (e) { e.preventDefault(); ... if (someCondition) { ... code ... } else { ... execute the link } }); | 
我希望,如果
| 1 2 3 4 5 6 7 8 9 10 11 | $('#myLink').click(function (e) { e.preventDefault(); ... if (someCondition) { //do stuff } else { location.href = $(this).attr('href'); } }); | 
只需在if/else语句中移动
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | $('#myLink').click(function (e) { ... if (someCondition) { e.preventDefault(); ... code ... } else { ... execute the link } }); | 
看一下:jquery location href?
基本上你可以使用
把