const survey = new Survey.Model(json);
survey.onComplete.add((sender, options) => {
console.log(JSON.stringify(sender.data, null, 3));
});
survey.render(document.getElementById("surveyElement"));
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://unpkg.com/survey-core@2.2.4/survey.core.min.js"></script>
<script src="https://unpkg.com/survey-core@2.2.4/survey.i18n.min.js"></script>
<script src="https://unpkg.com/survey-core@2.2.4/themes/index.min.js"></script>
<script src="https://unpkg.com/survey-js-ui@2.2.4/survey-js-ui.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/survey-core@2.2.4/survey-core.min.css" />
<link rel="stylesheet" href ="./index.css" />
</head>
<body>
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
<script src="./json.js"></script>
<script src="./index.js"></script>
</body>
</html>
const json = {
"title": "AnthonyWheelerArt",
"description": "Please provide feedback.",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "radiogroup",
"name": "question1",
"title": "Are you enjoying the stream?",
"isRequired": true,
"choices": [
"Yes",
"No"
]
},
{
"type": "radiogroup",
"name": "question2",
"visibleIf": "{question1} = 'Yes'",
"title": "Why are you lying?",
"choices": [
{
"value": "Item 1",
"text": "I'm a liar."
},
{
"value": "Item 2",
"text": "I'm not!"
}
]
},
{
"type": "html",
"name": "question3",
"visibleIf": "{question1} = 'No' or {question2} = 'Item 1'",
"html": "That is the correct response."
},
{
"type": "html",
"name": "question5",
"visibleIf": "{question2} = 'Item 2'",
"html": "Then you're watching a stream other than AnthonyWheelerart."
}
]
}
],
"headerView": "advanced"
}