Cart Buy Licenses Contact Support Login/Register
v 1.8.11
v 1.8.11
Overview Examples Docs Source Download

Static Image

Add an image to your survey - Image element


                var json = {
   "elements": [
      "type": "image",
      "name": "banner",
      "imageLink": "",
      "imageWidth": "500px",
      "imageHeight": "300px"

                window.survey = new Survey.Model(json);
            survey.onComplete.add(function(result) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(, null, 3);
            ReactDOM.render(<Survey.Survey model={survey}  />, document.getElementById("surveyElement"));

<!DOCTYPE html>
<html lang="en">
    <title>Add an image to your survey - Image element, Reactjs Survey Library Example</title>

<meta name="viewport" content="width=device-width" />
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
<script src=""></script>
    <link href="" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">

            <div id="surveyElement" style="display:inline-block;width:100%;">
    <div id="surveyResult"></div>

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


survey.getQuestionByName('banner').imageHeight; survey.render();

survey.getQuestionByName('banner').imageWidth; survey.render();

Image fit mode: (default is 'contain')

var q = survey.getQuestionByName('banner');
q.imageFit = yourValue; 

Content mode : (default is 'image')

var q = survey.getQuestionByName('banner');
q.contentMode = yourValue;