title: passing a textbox value to a javascript function asp.net
body: <p>I am having a little difficulty with this one. Trying to pass a textBox value to a javascript function and get undefined instead. </p>
  
  <p>Advice perhaps on how I can get this variable to the function</p>
  
  <pre><code>&lt;input type="image" runat="server" id="btnSearchFunction" src="Images/searchIcon.png" name="image" onclick="SearchContent();" width="16" height="20" /&gt;
  &lt;input type="hidden" name="searchValue" value="&lt;%#txtSearch.Value %&gt;" /&gt;
  &lt;input type="text" runat="server" id="txtSearch" name="searchValue" class="input-medium search-query" placeholder="Search ..."/&gt;
  </code></pre>
  
  <p>and this is the function I am trying to pass it to</p>
  
  <pre><code>function SearchContent() {
      var txtBoxValue = $(this).parent().find("input[name='searchValue']").val();
      alert(txtBoxValue);
  }
  </code></pre>