I have a html table with a row that looks like:
<tr>
<td><input type="checkbox" name="check[]" value="265"></td>
<td>265</td>
<td>NO MATCH</td>
<td>https://stackoverflow.com/</td>
<td>No</td>
<td>0</td>
<td>f79a8316891</td>
</tr>
I am trying to build a jquery function that will dynamically create (if it doesn't already exist) and open up a bootstrap 2.32 popover if I pass it over a URL in table cell. So far I have:
$('td').on('mouseover', function(e) {
var contents = $( this ).html() ;
if (contents.match("^http")) {
console.log(contents);
this.innerHTML = '<a href="myreference.html" data-bind="popover"' + ' data-content="'+contents +'"> link </a>';
console.log(this.innerHTML);
};
// Trigger the popover to open
console.log(this.innerHTML );
$(this.innerHTML ).popover("show");
});
The popover portion of this is based on http://jsfiddle.net/8DP4T/1/
When I mouseover a url in the table it forms a popover link as expected, that looks like:
<a href="myreference.html" data-bind="popover" data-content="https://stackoverflow.com/"> link </a>
However as I hold the mouse over it no popup occurs.
Interestingly , I have also placed
<a href="myreference.html" data-bind="popover" data-content="https://stackoverflow.com/">Brick</a>
below my table and this is working with a popover created.
this appears to be a known problem with questions such as Twitter Bootstrap Popovers not working for Dynamically Generated Content . How can I get this working in my case?