Javascript examples for DOM HTML Element:Form Event
Changing the key value pair based on users input via JSON
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function Run() {/*from ww w .j a v a 2s . com*/ var x = document.getElementById("fruits"); var data = { "fruits": x.value }; console.log(data.fruits); } </script> </head> <body> <input id="fruits"> <button onclick="Run()">Run</button> </body> </html>