本文介紹了jQuery 工具提示添加換行符的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
所以,我想獲取包含多個 <br/>
的 div 的內(nèi)容,然后使用 jQuery 工具提示小部件將其作為標(biāo)題屬性傳遞.我希望這些線條出現(xiàn)在工具提示內(nèi)的另一個下方.謝謝.到目前為止的代碼是:
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>
推薦答案
您可以使用工具提示小部件的內(nèi)容"選項.另見:
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'
}
});
});
這篇關(guān)于jQuery 工具提示添加換行符的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!