2012-07-29 38 views
1

我有一個問題,下面的代碼,似乎我需要以某種方式轉義一些html的比賽,但我不明白具體到哪裏是問題,以及如何解決它,請幫助:)html標籤裏面的jquery .html

$(".alert_window_content").html('<div style="margin-top:15px; position:absolute; right:5; width:250px; z-index:2; opacity:0;"><input type="file" id="X" name="X" onChange="GetDiretory()"\> 
</div> 
    <div class="X"> 
<form><input class="X" type="button" value="X"></input><div class="X" style="background-color:white; width:160px; height:19px; float:right; margin-right:3px; margin-top:2px;"> 
</div> 
    <div style="display:inline-block;"><input class="X" type="submit" name="X" value="X"\></div> 
</form> 
</div> 
<div class="X" style="display:inline-block; margin-top:10px;"></div>');  

回答

0

我認爲它的,因爲你的所有輸入標籤是由\即關閉,

你寫

<input ...... \> 

而非

<input ....... /> 
0

不知道我理解正確你的問題,但如果你想在HTML標記顯示爲可讀的內容,你應該使用.text()而不是.html()

0

,如果你想擁有HTML代碼在你的.alert_window_content然後您需要使HTML代碼更有效:

$(".alert_window_content").html('<div style="margin-top:15px; position:absolute; right:5; width:250px; z-index:2; opacity:0;"><input type="file" id="X" name="X" onChange="GetDiretory()"></div><div class="X"><form><input class="X" type="button" value="X"><div class="X" style="background-color:white; width:160px; height:19px; float:right; margin-right:3px; margin-top:2px;"></div><div style="display:inline-block;"><input class="X" type="submit" name="X" value="X"></div></form></div><div class="X" style="display:inline-block; margin-top:10px;"></div>'); 

不知道如果你正在尋找