title: Reusable pop up throwing error at onclick event
body: <p>First post here, and newer to Javascript.</p>
  <p>I have a node.js / express app that I am building and would like to re-use a yes no pop up in my front end by just changing some variables.
  The pop up works and displays the messages, but when I click the yes button I get</p>
  <p>Uncaught ReferenceError: yesNoResponse is not defined at HTMLButtonElement.onclick</p>
  <p>I am using parcel to bundle all my front end scripts, and I have tried declaring the function in multiple places including the index.js which is the root for my parcel bundle.</p>
  <p>very confused on this one, any help is greatly appreciated.</p>
  <pre><code>export const showYesNo = (msg, secondaryMsg, onYes) =&gt; {
  
    function yesNoResponse(option) {
      if (option === 'overWrite') {
        console.log(option);
        hidePopUp();
      }
    }
  
    const markup = `&lt;div id=&quot;popup-yesno&quot; class=&quot;modal&quot;&gt;
                      &lt;div class=&quot;popup-container&quot;&gt;
                        &lt;div class=&quot;popup-inner-border&quot;&gt;
                          &lt;div class=&quot;popup-text-border&quot;&gt;
                            ${msg}
                            &lt;br /&gt;
                            ${secondaryMsg}
                          &lt;/div&gt;
                          &lt;div class=&quot;popup-button-container&quot;&gt;
                            &lt;button class=&quot;btn-popup-yes&quot; id=&quot;popup-yes-button&quot; onclick=&quot;yesNoResponse('${onYes}');&quot;&gt;
                              Yes
                            &lt;/button&gt;
                            &lt;button class=&quot;btn-popup-no&quot; id=&quot;popup-no-button&quot; onclick=&quot;yesNoResponse('no');&quot;&gt;
                              No
                            &lt;/button&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;`;
    document.querySelector('body').insertAdjacentHTML('afterbegin', markup);
  };
  </code></pre>