add or subtract functions from onSubmit event handler?

后端 未结 4 569
轮回少年
轮回少年 2020-12-21 10:05

I have the following code:

function showAddrBox() {
    var prompt = document.getElementById(\'addr_prompt\');
    prompt.style.display = \'block\';
    docu         


        
4条回答
  •  青春惊慌失措
    2020-12-21 10:06

    Use element.addEventListener("eventName", callbackFunction, false) and element.removeEventListener("eventName", callbackFunction).

    Where eventName is the name of the handler without the 'on'. So onsubmit becomes submit.

    For documentation of the two functions, see:

    • https://developer.mozilla.org/en/DOM/element.addEventListener
    • https://developer.mozilla.org/en/DOM/element.removeEventListener

提交回复
热议问题