const survey = new Survey.Model(json);
survey.onComplete.add((sender, options) => {
console.log(JSON.stringify(sender.data, null, 3));
});
survey.render(document.getElementById("surveyElement"));
const json = {
"logoPosition": "right",
"pages": [
{
"name": "page1",
"elements": [
{
"type": "imagepicker",
"name": "question1",
"choices": [
{
"value": "Image 3",
"text": "Yes",
"imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg"
},
{
"value": "Image 1",
"imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg"
},
{
"value": "Image 2",
"imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg"
},
{
"value": "Image 4",
"imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg"
}
],
"imageFit": "cover",
"showLabel": true,
"multiSelect": true
},
{
"type": "tagbox",
"name": "question2",
"choices": [
"Item 1",
"Item 2",
"Item 3"
]
}
]
}
]
}
<!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@1.12.9/survey.core.min.js"></script>
<script src="https://unpkg.com/survey-core@1.12.9/survey.i18n.min.js"></script>
<script src="https://unpkg.com/survey-core@1.12.9/themes/index.min.js"></script>
<script src="https://unpkg.com/survey-js-ui@1.12.9/survey-js-ui.js"></script>
<link rel="stylesheet" href="https://unpkg.com/survey-core@1.12.9/defaultV2.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>