Jump to content

diox76

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by diox76

  1. Hi everyone,

     

    According to the explanation about this method here, it accepts three parameters:

    - new event created in runtime;

    - anonymous (or not) function;

    - a third parameter (boolean).

     

    I would like to know if the first parameter can be a variable such as "newEvent" instead to write as literal ("click")

    E.g.:

     

    function myfunction(myId, newEvent)

    {

    document.getElementById(myId).addEventListener(newEvent, function(){

     

    ...

     

    });

    }

     

    Is this possible? My idea is pass a value to my function as parameter to 'addEventListener' method.

     

    Thanks in advance.

     

    Best regards.

    :)

×
×
  • Create New...