Image Picker

Custom widget: Image Picker Third-party libraries: ImagePicker MIT

                        



var json = {
   "elements": [
      {
         "type": "imagepicker",
         "name": "choosepicture",
         "title": "What animal would you like to see first ?",
        "choices": [
          {
            "value": "lion",
            "imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg"
          },
          {
            "value": "giraffe",
            "imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/giraffe.jpg"
          },
          {
            "value": "panda",
            "imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/panda.jpg"
          },
          {
            "value": "camel",
            "imageLink": "https://surveyjs.io/Content/Images/examples/image-picker/camel.jpg"
          }
        ]
      }
   ]
};

window.survey = new Survey.Model(json);


survey.onComplete.add(function(result) {
    document.querySelector('#surveyResult').innerHTML = "result: " + JSON.stringify(result.data);
});


$("#surveyElement").Survey({ 
    model: survey 
});


                    
<!DOCTYPE html>
<html>
<head>
    <title>Custom widget: Image Picker, jQuery Survey Library Example</title>
    <script src="https://unpkg.com/jquery"></script>
<script src="https://surveyjs.azureedge.net/1.0.27/survey.jquery.js"></script>
<link href="https://surveyjs.azureedge.net/1.0.27/survey.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/image-picker/0.3.0/image-picker.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/image-picker/0.3.0/image-picker.css" />
    <script src="https://unpkg.com/surveyjs-widgets"></script>

</head>
<body>
                <div id="surveyElement">
            </div>
    <div id="surveyResult"></div>

<script type="text/javascript" src="./index.js"></script>

</body>
</html>