2012-11-13 118 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>\ 
 
');

相關問題