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

HTML

Use html elements, including video and audio, inside your survey - Html question)


                        
        
            Survey.StylesManager.applyTheme("default");
        


            
                var json = { questions: [
    { type: "html", name: "info", html:"<table><body><row><td><img src='/Content/Images/examples/26178-20160417.jpg' width='100px' /></td><td style='padding:20px'>You may put here any html code. For example images, <b>text</b> or <a href='https://surveyjs.io/create-survey'  target='_blank'>links</a></td></row></body></table>" }
]};

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

                    
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Use html elements, including video and audio, inside your survey - Html question), Knockoutjs Survey Library Example</title>

<meta name="viewport" content="width=device-width" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js"></script>
<script src="https://surveyjs.azureedge.net/1.7.10/survey.ko.js"></script>
<link href="https://surveyjs.azureedge.net/1.7.10/survey.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">

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

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

</body>
</html>
settings

html property:

var q = survey.getQuestionByName('info');
q.html = yourHtml; 
survey.render();