[英]line break tag in specific situation html and javascript
I have this little javascript 我有这个小javascript
$(document).ready(function() {
// Tooltip only Text
$('.masterTooltip').hover(function(){
// Hover over code
var title = $(this).attr('title');
$(this).data('tipText', title).removeAttr('title');
$('<p class="tooltip"></p>')
.text(title)
.appendTo('body')
.fadeIn('slow');
}, function() {
// Hover out code
$(this).attr('title', $(this).data('tipText'));
$('.tooltip').remove();
}).mousemove(function(e) {
var mousex = e.pageX + 20; //Get X coordinates
var mousey = e.pageY + 10; //Get Y coordinates
$('.tooltip')
.css({ top: mousey, left: mousex })
});
});
its making image titles appear very nice, but I cant find a way to put a line break in there. 它制作的图像标题看起来非常好,但我找不到一种方法在那里放置一个换行符。
I have tried <br> </br> <br/>   
 n/
nothing worked 我试过了
<br> </br> <br/>   
 n/
什么都没有用
如果要插入html,请使用.html()
而不是.text()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.