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>http://stackoverflow.com/</td>
<td>No</td>
<td>0</td>
<td>f79a8316891</td>
</tr>
I am trying to build a jquery function that will open up a bootstrap 2.32 popover if I pass it over a URL in table cell. So far I have:
$("[data-bind='popover']").popover({
trigger: 'hover',
html: true,
content: function(){
return $(this).data('content');
}
});
$('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);
}
});
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. However as I hold the mouse over it no popup occurs as far as I can see. The code does work , but it is not triggering the popover.
Interestingly , I have also placed
<a href="myreference.html" data-bind="popover data-content="http://upload.wikimedia.org/wikipedia/commons/a/a5/Flower_poster_2.jpg">Brick</a>
below my table and this is working with a popover created. I'm wondering if this behavior has something to do with the order of operations because the popover link is created dynamically after the DOM is already set. Can someone advise me here?