$(window).load(function() {
$("head").append(' ')
$(".row-fluid").after('')
$(".autofillbutton").click(function(){
$(".qst").each(function(){
if ($(this).find(".mrQuestionTable").length){
//loop
$(this).find(".mrQuestionTable tr").each(function(){
var x = $(this).find(".mrMultiple,.mrSingle").length
console.log(x)
var rand = Math.floor(Math.random()*x) + 1;
$(this).find(".mrMultiple,.mrSingle").eq(rand-1).iCheck("check")
console.log(rand)
});
}
if (!$(this).find(".mrQuestionTable").length && $(this).find(".mrMultiple,.mrSingle").length){
if (!$(this).find(".inputBoxTD").length){
var x = $(this).find(".mrMultiple,.mrSingle").length
var rand = Math.floor(Math.random()*x) + 1;
$(this).find(".mrMultiple,.mrSingle").eq(rand-1).iCheck("check")
}else{
}
}
if ($(this).find(".mrEdit:not('.mrOtherEdit')").length){
$(this).find("input[type='text'].mrEdit,textarea.mrEdit").val("Dummy response")
$(this).find("input[type='number'].mrEdit,input[typepc='number'].mrEdit").val(Math.floor(Math.random()*100) + 1)
}
if ($(this).find("select").length){
$(this).find("select option:nth-child(2)").attr("selected",true)
}
});
});
});