Javascript examples for DOM HTML Element:Form Event
Reading json from hidden input value with JSON.parse()
<html> <head></head> <body> <input id="hdn" type="hidden" value="{"products":{"id":100001,"name":"TESTTTT"}}"> <script type="text/javascript"> var jsonObj = JSON.parse(document.getElementById('hdn').value); console.log(jsonObj); console.log(jsonObj.products.name); console.log(jsonObj); console.log(jsonObj.products.name); //from w ww . j a va2 s .c o m </script> </body> </html>