2012-01-10 34 views
0

我有一個功能,其中用戶可以保存應用程序的狀態,應用程序由許多視覺元素爲了這個,我覺得我的存儲工作區的div的整個HTML串的得到DIV的HTML內容是動態更新自身

<div id = "workspace"> 
<div id = "playground"> 
    here is my all div where user drag n drop the component from left hand side 
</div></div> 

我現在做

var x = $("#playground").html() // to get all html content inside the playground div 
alert(x) 

現在X是給我只能說我已經寫在HTML文檔不是其他分區,這是追加當用戶拖動ñ下降到操場上的html代碼

任何機構是否自動保存任何更好的解決方案,並恢復到原來的狀態,請讓我知道

here is the link to the application

謝謝

+0

嘗試使用.text代替.html!也許這會起作用。 – viper 2012-01-10 15:52:56

回答

0

指定一個類像.droppableThing,所有droppables然後用

$("#playground").child('.droppableThing')

0

試試這個吧。

var x = document.getElementById("playground").innerHTML; 
alert (x); 
+0

這是在javascript中的相同的東西:/ – viper 2012-01-10 15:55:23

0

「操場」在HTML的拼寫「playgraound」。 $("#playground").html()似乎工作。這可能是你的問題嗎?