所以,我想获取包含多个 <br/> 的 div 的内容,然后使用 jQuery 工具提示小部件将其作为标题属性传递.我希望这些线条出现在工具提示内的另一个下方.谢谢.到目前为止的代码是:
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
简短示例:
$(function() {
$( document ).tooltip({
content: function() {
return 'foo'
}
});
});
这篇关于jQuery 工具提示添加换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
用于创建头像的 jQuery/JavaScript 库?jQuery/JavaScript Library for avatar creation?(用于创建头像的 jQuery/JavaScript 库?)
如何做以下掩码输入问题?How to do following mask input problem?(如何做以下掩码输入问题?)
使用 DropKick Javascript 设置值/标签的问题Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 设置值/标签的问题)
如何对 jquery 插件中的私有方法进行单元测试?how to unit-test private methods in jquery plugins?(如何对 jquery 插件中的私有方法进行单元测试?)
stellar.js - 为垂直滚动网站配置偏移量/对齐元素stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 为垂直滚动网站配置偏移量/对齐元素?)
jQuery 屏蔽输入插件.当文本框获得焦点时选择所有jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽输入插件.当文本框获得焦点时选择所有内容)