pass argument to function using addEventListener

后端 未结 1 1898
你的背包
你的背包 2020-12-22 11:55

i am quite new to addEventListener method.i am trying to pass argument to function using addEventListener .but it is not worining.why i can\'t passing the string \"2a\" usin

1条回答
  •  既然无缘
    2020-12-22 12:29

    Only way to do that is to use an anonymous function

    function lister(){
        document.getElementById("tab1").addEventListener("click", function() {
            myfunc("2a");
        }, false);
    }
    

    0 讨论(0)
提交回复
热议问题