My jQuery is behaving extremely weirdly. When click the button/anchor for the first time on page load it doesn't expand the popover div. But the jQuery is running and a console.log statement is executing. Only after click the button/anchor once, then clicking on something else on the page and then returning to click the button is the button performing expectedly. I am not able to make sense of this behavior. Please guide.
$('.BookAppButton').click(function(event){
event.preventDefault();
console.log("Button Clicked..");
$('.BookAppButton').popover({
title : '',
html : 'true',
content:'<div><p>I should have popped on first click</p></div>'
});
});
Here is the JSFiddle link. If you run the code you'll understand the weird behavior I am talking about : http://jsfiddle.net/8yyjyte1/#&togetherjs=B36bVLS1R7
Thank you in advance.