title: Make <p> toggle reappear
body: <p>I've made a lookup tool where a list of items appear, and when the item is clicked the menu disappear. This may be a smple fix</p>
  
  <p>Works great the first time, but then the lookup tool does not work afterward.</p>
  
  <p>First, you type your item in a textbox with a div that calls the lookup:</p>
  
  <pre><code>&lt;input type="text" name="item" id="item" onkeyup="showResult(this.value)"     placeholder="Enter Item Number" autocomplete="off"&gt;
  &lt;div id="lookup"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>My items look like this:</p>
  
  <pre><code>&lt;p&gt;&lt;a href=# onclick=\"xmlhttpPost(lookup string and target div)&gt;Item&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I used this script to make the item disappear upon click:</p>
  
  <pre><code>$(document).ready(function () {
  
      $('#lookup').on({
  
         click: function () { $('#lookup').toggle();
         return false; }
  
      }, 'a');
  
  });
  </code></pre>
  
  <p>Works well the first time, but it permanetly hides the lookup afterward.</p>
  
  <p>Here's the redacted lookup code:</p>
  
  <pre><code>function showResult(str,itemnum)
  {
  
      if (str.length==0)
        {
        document.getElementById("lookup").innerHTML="";
        document.getElementById("lookup").style.border="0px";
        return;
        }
      if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
        }
      else
        {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      xmlhttp.onreadystatechange=function()
        {
        if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
          {
          document.getElementById("lookup").innerHTML=xmlhttp.responseText;
          document.getElementById("lookup").style.border="1px solid #A5ACB2";
          }
       }
        var e = document.getElementById("location");
        var location = e.options[e.selectedIndex].value;
  
      xmlhttp.open("GET","sql/lookup.php?category="+location+"&amp;name="+str,true);
      xmlhttp.send();
      }
  </code></pre>
  
  <p>I'm about to wrap this project but this is the last little fix. Thanks in advance.</p>