I have a button which launches a popover when clicked (just like the live demo here: http://twitter.github.com/bootstrap/javascript.html#popovers)
Now I would like a simple like button in the content field of the popover. Is that possible? Currently, the popover does display only the link as text "http://test.com"
Currently:
<a href="#" id="example" rel="popover" data-content="http://test.com" data-original-title="Like"><img src="img/specialbutton.png"></a>
To create a popover, you need to add the data-bs-toggle="popover" attribute to an element. Whereas, popover's title and its content that would display upon trigger or activation can be specified using the title and data-bs-content attribute respectively.
To create a popover, add the data-toggle="popover" attribute to an element. Note: Popovers must be initialized with jQuery: select the specified element and call the popover() method.
js and minified bootstrap. bundle. min. js ) include Popper, but not jQuery.
Default title value if title attribute isn't present. If a function is given, it will be called with its this reference set to the element that the popover is attached to. How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
I am not completly sure what you mean with a like-button. In order to place a button with the anchortext "like" and a link to "http://test.com" on the popover :
1 Remove all data-xxx references from your <a>
-tag
<a href="#" id="example" rel="popover"><img src="img/specialbutton.png"></a>
2 invoke the popover like this
$('#example').popover({
placement: 'right',
title: 'Like this website?',
html: true,
content: '<button class="btn"><a href="http://test.com">Like</a></button>'
});
You can place many types of HTML-tags in content
, maybe you want a gruop of buttons to various social media? If you want to add a facebook-button you must follow the guidelines for this and insert the code generated from there in content
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With