title: Show a specific data from jinja2 according to a checkbox is checked or not
body: <p>I have a specific select that I would change the options according to with a checkbox that is either checked or not. This select is inside another Jinja2 loop, like below:</p>
  <pre><code>    {% for row in tbl_cli %}
  ...code before the specific header and checkbox ...
          &lt;th width=29%   style=&quot;background-color: #DBCEA7;color:black;z-index: 100;&quot;&gt;Destino&lt;br&gt;&lt;label sytle=&quot;display: inline-block;&quot;&gt;&lt;input type=&quot;checkbox&quot; onClick=&quot;libera(this)&quot; id=&quot;libera_check&quot; /&gt; Habilitar todas as agências &lt;/label&gt;   &lt;/th&gt;
          &lt;tr&gt;
          ... a lot of code ...
          &lt;td&gt;
              &lt;select class=&quot;form-select&quot; style=&quot;font-size: 10px; width: 90%&quot; name=&quot;ger_escolhido&quot; id=&quot;{{ row['ID_ROW_GRTE'] }}&quot;&gt;
                  &lt;option value=&quot;&quot; disabled selected&gt;Selecione o gerente destino&lt;/option&gt;
                  
                  {% if variable_to_check == 0   %} 
                      {% for ger in tbl_codger %} 
                          &lt;option style=&quot;font-size: 10px;&quot; name=&quot;{{ ger['CHAVE'] }}&quot;&gt;{{ ger['CHAVE'] }}&lt;/option&gt;
                      {% endfor %}
                  {% else %}
                      {% for ger_ag_de in tbl_codger_AG_DE %}
                          &lt;option style=&quot;font-size: 10px;&quot; name=&quot;{{ ger_ag_de['CHAVE'] }}&quot;&gt;{{ ger_ag_de['CHAVE'] }}&lt;/option&gt;
                      {% endfor %}
                  {% endif %}
                  
              &lt;/select&gt;
              
          &lt;/td&gt;
          ... another chunck of code ...
      &lt;/tr&gt;
      {% endfor %}
  </code></pre>
  <p>So far, I've created a variable called variable_to_check in the javascript, but the jinja2 does not seem to get the value of this variable:</p>
  <pre><code>variable_to_check == 0
  function libera() {
      let check = document.getElementById('libera_check')
  
      
      if (check.checked) {
  
      var_libera_todas_agencias = 1
      
   
      
  } else {
              
      var_libera_todas_agencias = 0
      
  }
  
  
  }
  </code></pre>