在Jquery工具提示插件中插入一个新行

时间:2012-11-13 14:52:04

标签: jquery tooltip jquery-tooltip

以下是我用于jquery插件的css。

  

CSS

<style type="text/css">
    body, div { font-family: arial, sans-serif;}
    body { margin: 0; padding: 0; }
    h3 {
        font-size: 110%;
        font-weight: normal;
        margin: .2em 0 .5em 0;
    }
    #tooltip {
        position: absolute;
        z-index: 3000;
        border: 1px solid #111;
        padding: 5px;
    }
    #tooltip h3, #tooltip div { margin: 0; }
</style>
  

脚本

<script type="text/javascript">
    $(function () {
        $('.studentclass').tooltip({ showURL: false, positionLeft: true, html:true});
        $("#block").click($.tooltip.block);
    });
</script>
  

HTML

<label id="lblstudentname" 
    runat="server" 
    title="Name of the student in the class "
    class="studentclass">
        STUDENT
    </label>

我尝试使用/ br,/ r / n,然后在标题中按Enter键,但它们似乎都不起作用。有人可以帮帮我吗 。

2 个答案:

答案 0 :(得分:1)

That plug-in允许在工具提示中使用HTML。换行符的HTML为<br>

答案 1 :(得分:1)

您可以使用jquery tipsy,它支持<br />

或者如果你仍然想使用jquery工具提示,你可以这样做 - Multiple HTML lines with jquery tooltip plugin这是一个重复的问题/答案,类似于你想要完整的HTML支持你想要的。

jquery工具提示也应该支持<br />