title: dosearch function can not find in Js but can find inline why?
body: <p>Problem is that onkeydown="doSearch" gives error that can not find dosearch function which is in JS file but if I put it inline than its working fine.
  Am I doing something wrong?</p>
  
  <p><strong>//In JS file called jq.js</strong></p>
  
  <pre><code>jQuery().ready(function () {
      jQuery("#bigset").jqGrid({
          //Grid code
      }).jqGrid('navGrid', '#pagerb', { edit: false, add: false, del: false, search: true }, {}, {}, {}, { multipleSearch: true });
  
          var timeoutHnd;
          var flAuto = false;
  
          function doSearch(ev) {
              if (!flAuto)
                  return;
              //  var elem = ev.target||ev.srcElement;
              if (timeoutHnd)
                  clearTimeout(timeoutHnd)
              timeoutHnd = setTimeout(gridReload, 500)
          }
  
          function gridReload() {
              var nm_mask = jQuery("#item_nm").val();
              var cd_mask = jQuery("#search_cd").val();
              jQuery("#bigset").jqGrid('setGridParam', { url: "/Jq/bigset?nm_mask=" + nm_mask + "&amp;cd_mask=" + cd_mask, page: 1 }).trigger("reloadGrid");
          }
          function enableAutosubmit(state) {
              flAuto = state;
              jQuery("#submitButton").attr("disabled", state);
          }
      });
  </code></pre>
  
  <p><strong>//CSHTML page</strong></p>
  
  <pre><code>@model Learning.Ajax.Models.Order
  
  @{
      ViewBag.Title = "Index";
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
  
  &lt;div class="h"&gt;Search By:&lt;/div&gt;
  &lt;div&gt;
      Code&lt;br /&gt;
      &lt;input type="text" id="search_cd" onkeydown="doSearch(arguments[0]||event)" /&gt;
      &lt;input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)" /&gt; Enable Autosearch &lt;br/&gt;
  &lt;/div&gt;
  &lt;div&gt;
      Name&lt;br /&gt;
      &lt;input type="text" id="item_nm" onkeydown="doSearch(arguments[0]||event)" /&gt;
      &lt;button onclick="gridReload()" id="submitButton" style="margin-left:30px;"&gt;Search&lt;/button&gt;
  &lt;/div&gt;
  &lt;br /&gt;
  &lt;table id="bigset"&gt;&lt;/table&gt;
  &lt;div id="pagerb"&gt;&lt;/div&gt;
  
  
  &lt;br /&gt;&lt;br /&gt;
  @*&lt;table id="addgrid"&gt;&lt;/table&gt;
  &lt;div id="pagerad"&gt;&lt;/div&gt;
  &lt;input type="button" id="adddata" value="Add" /&gt;
  &lt;input type="button" id="editdata" value="Edit Selected" /&gt;*@
  
  
  &lt;script src="@Url.Content("~/Scripts/jq.js")" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>