2011-10-15 105 views
0

我不知道標題是否有意義,但代碼值得一個thousound字!jquery捕獲後執行href

這裏是:

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/78。 – Ryan

回答

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 
});