我有一个 html 表单,需要在 anchor 标记的标题属性中添加换行符。我在网上找到了一些解决方案,但它们都不适用于我的代码。
我尝试添加
\n
<br>
不确定缺少什么。是因为数据切换阻止了标题属性的破坏吗?
$(document).ready(function () {
$('form').attr('novalidate', true);
$('[data-toggle="tooltip"]').tooltip();
<a class="helptext fa fa-question-circle" data-toggle="tooltip" title="Additional information -
 You can provide further information here to for your
 application to issue a new card.
 Ensure a maximum of 200 characters
 is entered – including spaces."></a>
最佳答案
使用 JavaScript 设置标题对我来说很有效。
document.getElementById('asdf').title = 'line1\nline2';
关于javascript - 标题属性中的换行符在工具提示中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42798397/