我需要在html标签中包含我的title属性的某些位,以便在我单击一个元素时将它们设置为样式,然后弹出Magnific Popup。我现在正在尝试类似下面的东西:
<a href="path/to/img" title='<span class="date">2016 -</span> Title text goes here'> Content goes here </a>
但是,如果我在title属性中添加html标签,就像我上面那样,当使用title属性(如下所示)悬停元素时,它将使用html标签和标题文本显示它们:
<span class="date">2016 -</span> Title text goes here
我怎样才能实现这一点,这样我仍然可以设置日期样式并让它在没有html标签的情况下进行渲染,如:
2016 - Title text goes here
答案 0 :(得分:0)
我建议在初始化代码中使用javascript来执行类似的操作:
titleSrc: function() {
return "<span class='date'>2016 -</span> Title text goes here";
}
所述