2011-10-19 23 views
2

我在一個項目工作,找不到這個修復:編寫HTML/jQuery的

$("#description").attr("value", '<?php echo htmlentities($version["Description"], ENT_NOQUOTES);?>'); 

$version["Description"]值是Genérica和值的輸入文字是Gen & eacute ; rica

我嘗試:

header('Content-type: text/html; charset=UTF-8') ; 

以及不同的編碼上htmlentities像異或UTF-8。

我認爲jQuery的.html()可以幫助,但我如何使用它attr的價值?

+0

_ $ version [「Description」]的值是「Genérica」,輸入文本的值顯示爲「Genérica」._其中存在問題?這些字符串是相同的。 –

+0

輸入文字顯示gen&eac te;哥斯達黎加,一起... – ruudy

回答

0

您正在尋找jQuery val function在輸入(或textarea)中發佈內容。

你真正想要的是什麼html_entity_decode(轉讓&eacute;在&eacute;)而不是htmlentities(&eacute;在&eacute;)。

+0

獲得「Gen&eacute; rica」與val太 – ruudy

+0

感謝隊友,這個作品! – ruudy