Can I use complex HTML with Twitter Bootstrap's Tooltip?

后端 未结 5 1117
一生所求
一生所求 2020-11-27 11:13

If I check official documentation, I can see a property called HTML:

Name    |    Type       |    default  |    Description
---------------------------------         


        
5条回答
  •  醉酒成梦
    2020-11-27 11:59

    Just as normal, using data-original-title:

    Html:

    Visible text

    Javascript:

    $("[rel=tooltip]").tooltip({html:true});
    

    The html parameter specifies how the tooltip text should be turned into DOM elements. By default Html code is escaped in tooltips to prevent XSS attacks. Say you display a username on your site and you show a small bio in a tooltip. If the html code isn't escaped and the user can edit the bio themselves they could inject malicious code.

提交回复
热议问题