別人的一個表單,我該如何把他的input submit類型表單按鈕,加上一個click事件並阻止他的預(yù)設(shè)表單提交呢?
光陰似箭催人老,日月如移越少年。
你好,可以重寫 submit 按鈕的 onclick 事件,並在會後 return false;
即可。
以下是部分程式碼,僅供參考:
document.getElementById('submitButton').onclick = function() {
// your code here...
return false;
};