title: How to get value with variable id in jquery?
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function addDictToCookie(id) {
      var name = $("#" + id + "input[id = material_name]").val();
      var unit = $("#" + id + "select[id = material_unit] :selected").text();
      var count = $("#" + id + "input[id = material_count]").val();
      var dict = { "name": name, "unit": unit, "count": count }
      Cookies.set('new', dict, { expires: 0.001 })
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;form action="GET" id="{{material.Id}}"&gt;
      &lt;div class="col-sm-5 topbox_insidebox_insideblocks"&gt;
          &lt;input type="text" name=Material value="{{material.Id}}" class="in" readonly id="material_name"&gt;
      &lt;/div&gt;
      &lt;div class="col-sm-2 topbox_insidebox_insideblocks"&gt;
          &lt;select id="material_unit"&gt;
              &lt;option value="{{material.Volume}}"&gt;m^3&lt;/option&gt;
          &lt;/select&gt;
      &lt;/div&gt;
      &lt;div class="col-sm-5 topbox_insidebox_insideblocks"&gt;
          &lt;input type="text" name=Value value="{{material.Volume}}" class="in" readonly id="material_count"&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-white topbox_button" id="addToCart" onclick="addDictToCookie('{{material.Id}}')"&gt; Add&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I use variable of <code>django</code> for <code>&lt;form&gt;</code> tag. Now I want get value of input but defined var this function is <code>null</code>.</p>
  
  <p>How to solve this problem?</p>