stringify()

12 views
Skip to first unread message

mukesh kumar

unread,
May 8, 2013, 6:10:48 AM5/8/13
to googl...@googlegroups.com
<body>

hi buddy, 
i want to print the div content using JSON.stringify() in json form....but doesn't show the required result.like:
{"data":"HCL TECH","children":[{"data":"SW_TowerA","attr":{"rel":"file"}},{"data":"TowerB","attr":{"rel":"file"}},{"data":"SW_TowerB","children":[{"data":"TowerB","attr":{"rel":"file"}}],"attr":{"rel":"disabled"}},{"children":["TowerB1"]}],"attr":{"rel":"directory"}}.


<script>function showItem() {
    alert(JSON.stringify($('#HCL')));

    }
</script>

</head>
<body>
<div id="output" class="show" style="width: 50%;display:none" align="center"></div>
<div id="treeMsg" style="width: 50%;display:none" align="center"></div>
        <div id="HCL" class="demo" style="width: 50%"></div>
end
<button id ="yi" Value ="Click me" onClick="showItem()">click me</button>



</body>

</html>

Reply all
Reply to author
Forward
0 new messages