array-selects.html 740 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <script src="../../dist/jsoneditor.js"></script>
  6. </head>
  7. <body>
  8. <textarea class="debug" cols="30" rows="10"></textarea>
  9. <button class='get-value'>Get Value</button>
  10. <div class='container'></div>
  11. <script>
  12. var container = document.querySelector('.container');
  13. var debug = document.querySelector('.debug');
  14. var schema = {
  15. "type": "array",
  16. "title": "Selects",
  17. "items": {
  18. "title": "Select",
  19. "type": "boolean"
  20. }
  21. };
  22. var editor = new JSONEditor(container, {
  23. schema: schema
  24. });
  25. document.querySelector('.get-value').addEventListener('click', function () {
  26. debug.value = JSON.stringify(editor.getValue());
  27. });
  28. </script>
  29. </body>
  30. </html>