title: Dynamic popover/tooltip via Bootstrap with flask & python
body: <p>I'm trying to create dynamically generated tooltip/popover content for a site using bootstrap (3.1), flask and python. </p>
  
  <p>I have hyper-linked items in a table. When I mouse over those hyperlinks, I want a tooltip to appear; when the user clicks on the hyperlink I want them to go to the individual item page. Code (shortened for brevity):</p>
  
  <pre><code>&lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Item&lt;/th&gt;
        &lt;th&gt;Quantity&lt;/th&gt;
        &lt;th&gt;Color&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;{% include 'itemlink.html' %}&lt;/td&gt;
        &lt;td&gt;12&lt;/td&gt;
        &lt;td&gt;red&lt;/td&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>then in itemlink.html:</p>
  
  <pre><code> &lt;a href="{{linkitem.get_url()}}" class="itemlink" data-item-id="{{linkitem.id}}"&gt;
     &lt;img src="{{linkitem.image}}" alt="Item {{linkitem.id}}" class="smallicon" /&gt;
       {{linkitem|safe}}
   &lt;/a&gt;
  </code></pre>
  
  <p>Next: the content of what I want to be in the popover/tooltip box:</p>
  
  <pre><code>&lt;div id="item_{{boxitem.id}}" class="itembox"&gt;
      &lt;div class="itemimage"&gt;
        &lt;img src="{{boxitem.image}}" alt="{{boxitem.name}}" title="{{boxitem.get_title()}}" /&gt;
     &lt;/div&gt;
     &lt;div class="iteminfo"&gt;
       &lt;div class="itemtitle"&gt;
         {{boxitem.get_title()}}
       &lt;/div&gt;
       &lt;div class="itemdesc"&gt;
          {% autoescape off %}{{boxitem.get_desc()}}{% endautoescape %}
        &lt;/div&gt;
       &lt;/div&gt;  
      &lt;/div&gt;
  </code></pre>
  
  <p>I put this in a script on my page: </p>
  
  <pre><code>&lt;script&gt;
    $(document).ready(function(){
     $('#item_{{item.id}}').popover({
       html: true,
       placement: 'right',
       trigger: 'hover',
       selector: '[rel="popover"]'
     });
    });
   &lt;/script&gt;
  </code></pre>
  
  <p>I'm wondering if this part of the script is even possible? </p>
  
  <pre><code>  $('#item_{{item.id}}').popover({
  </code></pre>
  
  <p>EDIT TO ADD: (it's not, it threw a server error)<br>
  EDIT again: It had to be </p>
  
  <pre><code>$('.itembox#item_'+$(this).data(itemID')).popover
  </code></pre>
  
  <p><br>On what element should I add the rel=popover? </p>