title: Using Jquery with Jinja2 to provide onclick event inside a loop on each element
body: <p>So first off im fairly new to programming in general and definetley new to Jinja2. So I am using python with GAE for server side stuff. I am basically getting some data from the web and then parsing through it and displaying it on a web page. To display it correctly I am looping through the different elements using jinja2.</p>
  
  <pre><code>{% for new in news %}
      &lt;div&gt;{{new}}&lt;/div&gt;
      &lt;button id = "button"&gt;&lt;/button&gt;
      &lt;div id ="description"&gt; {{new.description}}&lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>The description part is hidden until it is clicked on by the user</p>
  
  <pre><code>$(#button).each(function(){
      $(this).click(function(){
        $(description).toggle();
      });
  
  });
  </code></pre>
  
  <p>This html is a seperate page that is getting Ajaxed in to my main html page. So basically I dont know how to select each element in the loop to show there individual descriptions. Using the .each() function in Jquery seemed like a good place to start but it wasnt working properly. Is there someway to change the div id to be something different each time it loops through like adding a number to it or something to make each one distinct? Thanks in advance for any help</p>