SOITA/static/script.js

21 lines
648 B
JavaScript

//$(function() {
// $(".newQuestionSection" ).draggable().resizable();
//} );
var questionId = 1;
$('.addQuestionButton').click(function(){
console.log("REEEEEEEE")
// Clone extra box, and remove duplicate ids
let clone = $("#question-copy").clone().removeAttr("hidden");
clone.id = "question"- + ++questionId;
//clone.find("*").removeAttr("id");
clone.find("*").each(function() {
$(this).attr("id", "q" + questionId + "-" + $(this).attr("id"));
});
clone.find("input:radio").each(function() {
$(this).attr("name", questionId);
});
// append it to div
$('#canvas').append(clone);
});