我不知道这个标题是否有意义,但代码值得称之为!
这是:
a href="http://twitter.com/intent/tweet?url=http://campaignmonitor.com/blog&text=I love the Campaign Monitor blog!&via=campaignmonitor&related=yarrcat" id="tweeter">Tweet it</a>
我有一个jquery按钮捕获事件点击:
$('#tweeter').click(function(){
do some var loading
and do some validation... and then.. execute the href !
});
实际上我喜欢在jquery函数中完成的href ...然后执行...可能是一个href =“#”
问题,我怎么对jquery函数说....执行href!
答案 0 :(得分:1)
$('#tweeter').click(function(e){
do some var loading
and do some validation...
if validation fails then e.preventDefault()
else don't do anything as the browser will continue and redirect to the link
});