jQuery工具提示添加换行符 [英] jQuery tooltip add line break
问题描述
所以,我想把一个div的内容放在其中,我有几个< br />
,然后使用jQuery工具提示将它作为标题属性传递小部件。我希望线条在工具提示内部出现在另一个下面。谢谢。到目前为止的代码是:
CSS
.Lines {
width:125px;
height:20px;
溢出:auto;
}
JavaScript
$(function(){
$(document).tooltip();
$(。Lines)。hover(function(){
IaTxt = $(this).html()
$ b $(this).prop('title',IaTxt)
})
});
HTML
< pre class =lang-html prettyprint-override> < div class =Lines>
第一行。
< br />第二行。
< br />第三行!
< br />第四行?
< / div>
您可以使用工具提示的'content'选项小部件。另请参阅:
http:// jqueryui。 com / tooltip /#custom-content
简短例子:
$(函数(){
$(document).tooltip({
content:function(){
return'foo'
}
} );
});
So, I want to take the content of a div in which I have several <br/>
, and then pass it as a title attribute using jQuery tooltip widget. I want the lines to appear one beneath the other inside the tooltip. thx. the code so far is:
CSS
.Lines {
width: 125px;
height:20px;
overflow:auto;
}
JavaScript
$(function () {
$(document).tooltip();
$(".Lines").hover(function () {
IaTxt = $(this).html()
$(this).prop('title', IaTxt)
})
});
HTML
<div class="Lines">
First line.
<br/>Second line.
<br/>Third line!
<br/>Fourth line?
</div>
You can use the 'content' option of the tooltip widget. See also:
http://jqueryui.com/tooltip/#custom-content
Short example:
$(function() {
$( document ).tooltip({
content: function() {
return 'foo'
}
});
});
这篇关于jQuery工具提示添加换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!