将自定义类添加到工具提示 [英] Adding custom class to tooltip
本文介绍了将自定义类添加到工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想风格(css)一些bootstrap-tooltip.js工具提示,而不会影响所有的工具提示。我尝试了很多不同的解决方案,但我总是最后添加一个类到触发工具提示的元素。
I want to style(css) some bootstrap-tooltip.js tooltips, without affecting all the tooltips. I have tried many different solutions but i allways end up adding a class to the element that triggers the tooltip.
这是我试过的:
$(function(){
$("[id$=amount]").tooltip({
trigger: 'manual',
placement: 'right'
}).addClass("test"); // <--- This does not help me. Class just ends up
}); // in the trigger element. Se html output
// from firebug below...
在元素中触发工具提示:
But then the class just ends up in the element that triggers the tooltips:
<input
id="list_wishes_attributes_0_amount"
class="test" <!-- The class I tried to add to the tooltip ended up here. -->
type="text"
tabindex="3"
size="30"
rel="tooltop"
name="list[wishes_attributes][0][amount]"
min="0"
data-original-title="Only numbers please"
/>
如何为我的工具提示分配自定义类,而不是触发它的输入字段? / p>
How can i assign a custom class for my tooltip, and not the input field that triggers it?
推荐答案
$().tooltip({
template: '<div class="tooltip CUSTOM-CLASS"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
})
这篇关于将自定义类添加到工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文