I need to add images to each response in sharepoint 2013 survey like this:
I had no problem with question image. I just added string "image1" to question and then in jquery switched html like this:
$(document).ready(function() {
$(function () {
$(".ms-formlabel").each(function (index) {
var html = $(this).html();
if (html.indexOf("image1") != -1) {
$(this).html("<img src='https://portal.sp.corpnet.pl/witryny/ankiety/Config/images/zdjecie1-pytanie1.png'><br>1. Ten sympatyczny młody człowiek na zdjęciu to:");
}
});
});
});
But in answers/responses I have radio buttons with labels and I am not able to use same method. Maybe there is another way.
Solution:
$(document).ready(function() {
$(".ms-formbody label").each(function() {
var kontent = $(this).html();
if (kontent.indexOf("pytanie1-odpowiedz1") != -1) {
$(this).html("test1");
}
else if (kontent.indexOf("pytanie1-odpowiedz2") != -1) {
$(this).html("test2");
}
});
});