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

Markdown Radiogroup (Showdown)

Use markdown to render images in title and question elements


                var json = { questions: [
    "type": "radiogroup",
    "hasOther": true,
    "isRequired": true,
    "name": "favoritePet",
    "title": "What is your favorite pet ![A parrot]( =16x16) ?",
    "choices": [
        "value": "dog",
        "text": "Dog: ![A dog]( =14x14)"
        "value": "cat",
        "text": "Cat: ![A cat]( =14x14)"
        "value": "parrot",
        "text": "Parrot ![A parrot]( =14x14)"

                window.survey = new Survey.Model(json);
            survey.onComplete.add(function(result) {
            document.querySelector('#surveyResult').textContent =
            "Result JSON:\n" + JSON.stringify(, null, 3);
//Create showdown mardown converter
var converter = new showdown.Converter();
survey.onTextMarkdown.add(function(survey, options){
    //convert the mardown text to html
    var str = converter.makeHtml(options.text);
    //remove root paragraphs <p></p>
    str = str.substring(3);
    str = str.substring(0, str.length - 4);
    //set html
    options.html = str;
            model: survey 

<!DOCTYPE html>
<html lang="en">
    <title>Use markdown to render images in title and question elements, jQuery Survey Library Example</title>

<meta name="viewport" content="width=device-width" />
    <script src=""></script>
<script src=""></script>
    <link href="" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="./index.css">
<script src=""></script>
            <div id="surveyElement" style="display:inline-block;width:100%;">
    <div id="surveyResult"></div>

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


SurveyJS supports markdown via onTextMarkDown event. You may use any JavaScript markdown library. In this example, we are using Showdown markdown. You may use all features that this or other libraries have.