5 Replies Latest reply: Oct 14, 2016 10:26 AM by Adam Davies RSS

    simple extension query! function undefined

    Adam Davies

      Dear All,

       

      A simple one I am sure but it has been a long week.


      This is the simple code I am wiring for a menu, why do I get a function undefined error for my close / open navs when I click the various items (the click works with a simple console.log)?

       

      html="<div id=''#' + divName' class='sidenav' >  "
      html = html+"<a href='javascript:void(0)' id='closebtn' class='closebtn' onclick='closeNav()'>&times;</a>"
      html = html+"<a href='#'>About</a>"
      html = html+" <a href='#'>Services</a>"
      html = html+"  <a href='#'>Clients</a>"
      html = html+"  <a href='#'>Contact</a>"
      html = html+"</div>"
      
      
      html = html+"<span style='font-size:30px;cursor:pointer' onclick='openNav()'>open</span>"
      
      
      
      
      
      
      
      
      /* Set the width of the side navigation to 250px */
      function openNav() {
          document.getElementById("'#' + divName").style.width = "250px";
      }
      
      
      /* Set the width of the side navigation to 0 */
      function closeNav() {
          document.getElementById("'#' + divName").style.width = "0";
      }
      _this.Element.innerHTML = html;