title: Connecting an HTML button with Javascript object data
body: <p>I'm trying to build a searchable database that will allow a user to type in the name of a state and see a small subset of that state's laws (traffic laws, age of consent, conceal and carry laws, etc.). I'm getting confused on how a user submitted string will interact with my Javascript objects. I have seen people submitting questions regarding adding user-submitted integers or concatenating but what I am trying to do is slightly different.</p>
  
  <p>I am able to assign the user-submitted text as a variable via the getElementById method but now I'm lost. My question is this: How do I connect that user submitted variable with my objects' key values in Javascript so that when a user types in "Minnesota" and clicks the find button it retrieves and displays my Javascript data (which is information about Minnesota's state laws stored as object keys)?</p>
  
  <p>Here is a subset of the <strong>HTML</strong> in question:</p>
  
  <pre><code>&lt;div class="formDiv"&gt;
  &lt;form id="searchbox" action=""&gt;
    &lt;!--Search field--&gt;
    &lt;input id="search" type="text" placeholder="Ex: Minnesota"&gt;&lt;/input&gt;
    &lt;!--Submit button--&gt;
    &lt;input id="submit" type="submit" value="Search"&gt;&lt;/input&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;!--Where I want the Javascript object to be displayed--&gt;
  &lt;div class="answer"&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And here is the <strong>Javascript</strong> with just one object for simplicity:</p>
  
  <pre><code>var Minnesota = {
    name: "Minnesota",
    consent: 18,
    openBottle: true,
    deathPen: false,
    conceal: "Conceal &amp; Carry",
    txtDriveBan: true,
    talkDriveBan: false
  }
  $(document).ready(function() {
    $("#submit").on('click', function(){
    var State = document.getElementById("#search");
    //At this point, what do I write to display Minnesota's information stored in the object?//
    });
  });
  </code></pre>
  
  <p>Thanks very much for any help!</p>