Another DEMO... with Link inside popover as mentioned in comment in Question.
http://jsfiddle.net/weuWk/1126/
Related code..
var img = '<a href="https://si0.twimg.com/a/1339639284/images/three_circles/twitter-bird-white-on-blue.png" target="_blank" id="1">TEST</a>';
$("#blob").popover({
trigger: "manual",
content: img
}).on("click", function(e) {
e.preventDefault();
}).on("mouseenter", function() {
$(this).popover("show");
$(this).siblings(".popover").on("mouseleave", function() {
$(this).hide();
});
}).on("mouseleave", function() {
var _this = this;
setTimeout(function() {
if (!$(".popover:hover").length) {
$(_this).popover("hide")
}
}, 100);
});
$(document).on('click', '#1',function(){
console.log("CLicked");
});
Update considering the bootrstrap popover. If its still not working for you, better show HTML or even better show your problem DEMO on jsfiddle.
http://jsfiddle.net/AFffL/547/
<a class="popup-marker btn" data-content="Click outside the popover to close it." data-original-title="Popover A" href="youtube.com" target="_blank">Click me (A)</a>
jQuery(function() {
$('.popup-marker').popover().on('click', function(e) {
// if any other popovers are visible, hide them
var a='Hi!';
var clicked='yes';
console.log(a+clicked);
});
});
_----------------------------------------------------
The code you have shown does do exactly what you saying...
See demo at
http://jsfiddle.net/tymeJV/CE2k5/ (.. By tymeJV in comment)...
However if the link is loaded at runtime by dom manipulation or by Ajax, then your code might not work.
In that case try below code.
$(document).on('click','#LinkClick1',function(){
var a='Hi!';
var clicked='yes';
console.log(a+clicked);
});
Instead of $(document) you can use the Selector for parent of the #LinkClick1
console.log. Are you saying thatconsole.logisn't firing when you click the link?<a>element is added to the DOM. Move your<script>to the very end of the<body>.$(document).ready(function(){..}