How to pass arguments to addEventListener listener function?

前端 未结 30 2276
谎友^
谎友^ 2020-11-21 23:56

The situation is somewhat like-

var someVar = some_other_function();
someObj.addEventListener(\"click\", function(){
    some_function(someVar);
}, false);
<         


        
30条回答
  •  温柔的废话
    2020-11-22 00:36

        $form.addEventListener('submit', save.bind(null, data, keyword, $name.value, myStemComment));
        function save(data, keyword, name, comment, event) {
    

    This is how I got event passed properly.

提交回复
热议问题