Actually I want to call a function which is a pop over function of a jQuery, from the onclick attributes defined in HTML button tags. I can't succeed.
My script is:
<script type="text/javascript">
$(document).ready(function() {
$('#popoverId').popover({
html: true,
title: 'Popover Title <a class="close" href="#");">×</a>',
content: '<div class="msg">Your Text Here</div>',
});
$('#popoverId').click(function (e) {
e.stopPropagation();
});
$(document).click(function (e) {
if (($('.popover').has(e.target).length == 0) || $(e.target).is('.close')) {
$('#popoverId').popover('hide');
}
});
});
</script>
I want to run this code through the HTML onlick event
My HTML code is:
<input type="submit" id="popoverId" class="btn btn-large btn-danger" onclick="myfunction()" />
Actually I want to display the popover when I click that button but not from the button id. I want to display the popover when the function is called from the onclick event of the HTML as JavaScript.