我想了解如何在标题属性中添加中断,我想在标题属性中添加中断以区分名称。如何在标题属性中添加中断?
我有这样的东西
<p title="this is a description of the some text <br> and further description">Some Text</p>
结果是:
我想了解如何在标题属性中添加中断,我想在标题属性中添加中断以区分名称。如何在标题属性中添加中断?
我有这样的东西
<p title="this is a description of the some text <br> and further description">Some Text</p>
结果是:
如果您在需要换行符的位置添加新行,它适用于某些浏览器,但不是全部。
例子:
div { background-color: #c3c3c3; display: block; width: 100px; height: 100px; }
<div title="This is a text
Second line
Third line!">Contents</div>
JSFiddle:http:
//jsfiddle.net/g5CGh/
在标题文本中替换<br>
为<br />
<p title="this is a description of the some text <br /> and further description">Some Text</p>
现在<br />
用换行符\n
(jquery)替换:
<script>
$(document).ready(function(){
$('p').each(function(){
var a = $(this).attr('title');
var b = a.replace('<br />','\n');
$(this).attr('title', b);
});
});
</script>
希望我对你有所帮助