title: document.getelementbyid not recognizing razor element
body: <p>In my index.cshtml file I have a razor element (@Html.EditorFor) that's a text box. Javascript isn't recognizing the element. If I change the element type to a non-razor syntax then javascript can see it. Am I missing some syntax here.</p>
  
  <p>index.cshtml</p>
  
  <pre><code>&lt;div class="jumbotron"&gt;
  &lt;h1&gt;my application&lt;/h1&gt;
  @using (Html.BeginForm("Results", "Home", FormMethod.Post))
  {
      &lt;div class="form-group"&gt;
          //javascript can't see mainpagequery
          @Html.EditorFor(model =&gt; model.SearchQuery, new { htmlAttributes = new { @class = "form-control", id = "mainpagequery" }})
          @Html.ValidationMessageFor(model =&gt; model.SearchQuery, "", new { @class = "text-danger" })
          //javascript can see mainpagequery in the non razor element here
          &lt;input type="text" class="form-control" placeholder="Search" id="mainpagequery"&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-default"&gt;Search&lt;/button&gt;
  }
  </code></pre>
  
  <p></p>
  
  <p>Here is my javascript. If I use razor then 'mainpagequery' is underlines because it can't see it, if I use html then it's fine. I know I'm hitting my javascript because I see the alert message pop up.</p>
  
  <pre><code>$(document).ready(function () {
  console.log("ready!");
  alert("mainpage autocomplete function entered");
  
  var input = document.getElementById('mainpagequery');
  var options = {
      types: ['(cities)'],
      componentRestrictions: { country: "us" }
  };
  var mainpagequery = new window.google.maps.places.Autocomplete(input, options);
  });
  </code></pre>