2013-04-23 130 views
0

我正在使用jquery mobile和JavaScript。我在響應是一個html內容的變量中有一些響應。現在我必須在jQuery Mobile的UI中顯示這個html內容。該內容應該顯示爲不是html的文本。jquery mobile顯示html內容

jquery("#content").html(wiJson); 

<div data-role="content" id="content"> 
</div> 

這是我在我的代碼jquery("#content").html(wiJson);已經使用,這是在JavaScript中使用和

<div data-role="content" id="content"> 
     </div> 

用於在jQuery Mobile的用戶界面

+0

jq(「#contentid」)。html(wijson);這實際上是工作,如果我把一些html內容在wijson。但那(wijson)包含json形式的html。這是造成問題的原因 – anilgontla 2013-04-24 09:33:30

回答

2

該內容應顯示爲文本不作爲html。

嘗試使用的.text()

jquery("#content").text(wiJson); 
0

您可以標籤添加預&碼到您的html和使用.append()jQuery的方法追加它。它會看起來像這樣。

jQuery('#content").append('<pre><code>wiJson</pre></code>'); 

希望這會有所幫助。