<!DOCTYPE html>
<html>
<head>
<title>Use options to customize the editor, SurveyJS Editor Example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<script src="https://surveyjs.azureedge.net/1.0.10/survey.ko.js"></script>
<link href="https://surveyjs.azureedge.net/1.0.10/surveyeditor.css" type="text/css" rel="stylesheet" />
<script src="https://surveyjs.azureedge.net/1.0.10/surveyeditor.js"></script>
<!-- Uncomment to use the ace editor in JSON Editor tab
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.min.js" type="text/javascript" charset="utf-8"></script>
-->
<!-- Uncomment to use the select2 instead of standard dropdown
<script src="https://unpkg.com/jquery"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
-->
</head>
<body>
<div id="surveyContainer">
<div id="editorElement"></div>
</div>
<script type="text/javascript" src="./index.js"></script>
</body>
</html>
var storageName = "TestSurvey";
var editorOptions = { };
//Create the Survey Editor with the default options
editor = new SurveyEditor.SurveyEditor("editorElement", editorOptions);
//Show state in the toolbar, for example: Saving/Saved/Loading etc.
editor.showState = true;
//Call saveSurveyFunc automatically on changing in Editor, adding/removing/editing questions/pages etc.
//The default value is false. A use must click the "Save" button, that will be displayed in the toolbar
editor.isAutoSave = true;
//Callback function, Editor calls it when you must save changes.
editor.saveSurveyFunc = function(saveNo, callback) {
window.localStorage.setItem(storageName, editor.text);
!!callback && callback(saveNo, true);
};
//Load the survey definition from a storage
editor.text = window.localStorage.getItem(storageName) || "";