2012-01-10 35 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()似乎工作。这可能是你的问题吗?