2012-07-20 70 views
0

目前,我有這個腳本提交按鈕的工作,任何人都可以幫我修改這個劇本也與環節的工作(A HREF)JQuery的修改腳本

$(document).ready(function(e) { 
    $('div.submitbutton').click(function(event) { 
     $(this).val('Loading.. Please wait'); 
     $('#loading').show(); 
     setTimeout(function() { 
      $('#myform').submit(); 
     }, 200); 
    }); 
}); 
+1

添加到'selector'如此,它也選擇錨元素,阻止默認動作。 – 2012-07-20 14:50:42

+1

請花時間閱讀jQuery文檔,尤其是http://api.jquery.com/category/selectors/。 – 2012-07-20 14:57:15

回答

2
$(document).ready(function(e) { 
    $('div.submitbutton, a').click(function(event) { 
    $(this).val('Loading.. Please wait'); 
    $('#loading').show(); 
    setTimeout(function() { 
     $('#myform').submit(); 
    }, 200); 
    }); 
}); 
-2

你只需要添加<a>您的選擇器提交按鈕例如

$('div.submitbutton a').click(function.....

+3

爲什麼你認爲鏈接在「按鈕」裏面? – 2012-07-20 14:56:50