title: Execute Javascript if Django template variable exist
body: <p>In my template, I am iterating over a django variable using a <code>for loop</code>.</p>
  
  <p>There is a <strong>Carousel</strong> within the td. </p>
  
  <p>What I want to do is add an overlay over the <strong>td with class CAROUSEL</strong> and <strong>not</strong> to anything within the If condition. if <code>animal.available</code> exist. Maybe execute javascript and add class that would add an overlay over the <strong>td</strong>. Basically, There should be a difference between the carousels where <code>animal.available</code> and where it doesn't.</p>
  
  <blockquote>
    <p>Basically, when inner html tag is populated by Django variable, I want the parent html to be overlayed.</p>
  </blockquote>
  
  <h2>template.html</h2>
  
  <pre><code>&lt;table&gt;
      &lt;td class="carousel"&gt;
      {% for animal in stores %}
          &lt;div&gt;
              &lt;ul&gt;
                  &lt;li&gt;Name: {{ animal.name }} &lt;/li&gt;
                  &lt;li&gt;Price: {{ animal.price }}&lt;/li&gt;
              &lt;/ul&gt;
          {% if animal.available %}
              &lt;!-- Add overlay over td -&gt;
          {% endif %}
          &lt;/div&gt;
      {% endfor %}
      &lt;/td&gt;
  &lt;/table&gt;
  </code></pre>
  
  <h2>Overlay css</h2>
  
  <pre><code>.overlay {
     background-color: rgba(0,0,0,0.5);
  }
  </code></pre>
  
  <p>How do I add overlay class to td with class carousel if django variable <strong>animal.available</strong> exist? There are many such td's in the table, generated dynamically, so adding ID to the elements is also not possible.</p>