How do I make the same function for different actions?

  • 0
    I have a code like this https://codepen.io/lanimya/pen/BazaeWZ
    Different code opens and closes modals.
    I wanted to combine it into a function and substitute it, but I get an error on line 25.
    I don't know how to fix it.
    Line 19 each - working code.

    I took the code itself from here - https://jsfiddle.net/oddhz43x/1/
    JavaScript Eliot Harrington, Aug 1, 2020

  • 2 Answers
  • 0
    slightly tweaked

    Anonymous

  • 0
    Lana , I didn't understand what kind of data-img you have, so I replaced the markup, believing that this is also a modal:







    Study.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!