-2

I am missing out something here. I am trying to get the image during execution and display in pophover. This pophover is on table row.

The basic flow is, user will hover on one row so this will show a popover on right holding the product image along with some description.

I was able to track the image but while returning the whole image tag is appending as string. Therefore, the code is parsed as string and displayed as it is.

How can I fix this?

$('body').popover({
    placement:"right",
    trigger:"hover",
    selector:'tr[id=popover]',
    content:function(){
        return '<img src = "' + $(this).children("td").children("img")[0].currentSrc + '" width="200" height="200">'
    }
});

I am thinking if I can convert the return part to normal image tag then that can solve this issue.

Hope this screenshots helps.

enter image description here enter image description here

Kiran Rai Chamling
  • 460
  • 1
  • 6
  • 15

2 Answers2

0

https://getbootstrap.com/docs/3.3/javascript/#popovers-options:

html | boolean | false
Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.

CBroe
  • 91,630
  • 14
  • 92
  • 150
-2

Render it inside of jQuery so for example

var x = $(content);
parentEl.append(x)
Richard Abear
  • 166
  • 1
  • 15