2012-11-13 117 views
0

使用http://www.davidjrush.com/blog/2011/12/simple-jquery-tooltip/中的一些简单jQ逻辑创建一个类似效果的简单工具提示。如何通过jQ.append()传递换行符?

但是,当我在JQ代码中添加一个换行符时,所有内容都会向南并且逻辑停止工作(FF)。

作品:

$(this).append('<div class="tooltip"><p>This is a tooltip. It is typically used to explain something to a user without taking up space on the page.</p></div>'); 

并不:

$(this).append(' 
<div class="tooltip"><p>This is a tooltip. It is typically used to explain something to a user without taking up space on the page.</p></div> 
'); 

检查它指出什么我可以找到这个是一个问题的JQ文档。

任何人都知道为什么,它打破和/或如何传递换行符jQ.append()

回答

3

你要跳过符合反斜线打破了追加内。

你的情况

$(this).append('\ 
 
<div class="tooltip"><p>This is a tooltip. It is typically used to explain something to a user without taking up space on the page.</p></div>\ 
 
');

相关问题