I have a popover which displays the image: my html:
%a#btn2{"data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}".html_safe ,"data-placement" => "bottom"} Click to toggle popover
my js:
$('#btn2').popover trigger: "hover", html: true
I want to export this fragment to my js: "data-content" => "#{ image_tag CarConfiguration.last.image_url.to_s}"
How can I do it?
You can set the content in the js function that defines the popover.
It would be something like this:
var myPopoverContent = "#{ image_tag CarConfiguration.last.image_url.to_s}".html_safe;
$('#btn2').popover({
trigger: 'hover',
html: true,
content: myPopoverContent
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.