title: Razor view MVC 5 JavaScript - resolve document.getElementById
body: <p>Migrating my MVC3 (aspx) project to MVC5 (razor), I use:</p>
  
  <pre><code>                &lt;% if ((bool)this.ViewData["ReadOnly"] != true)
                     { %&gt;
                      document.getElementById("NextAction").value = nextAction;
                      document.getElementById("VisitForm").submit();
                  &lt;% } else { %&gt;
                      window.location = nextAction;
                  &lt;% } %&gt;
  </code></pre>
  
  <p>I modified it to:</p>
  
  <pre><code>                     @if ((bool)this.ViewData["ReadOnly"] != true)
                       {
                         document.getElementById("NextAction").value = nextAction;
                         document.getElementById("VisitForm").submit();
                       } else {  
                          window.location = nextAction;
                       }  
  </code></pre>
  
  <p>Can not resolve either document or window?</p>