5 $('#submit_answers').click(function(e) {
9 $('.exercise-wtem').each(function() {
11 if(el.hasClass('exercise')) {
14 var type = el.attr('data-type');
20 console.log(JSON.stringify(to_submit));
21 $('input[name=answers]').val(JSON.stringify(to_submit));
24 var push_answer = function(el, answer) {
25 to_submit[el.attr('data-id')] = answer
29 edumed: function(el) {
30 var exercise = el.data('exercise'),
33 if(exercise.get_answers) {
34 to_push.closed_part = exercise.get_answers()[0];
36 open_part = el.find('.open_part')
37 if(open_part.length) {
38 to_push.open_part = open_part.find('textarea').val();
41 push_answer(el, to_push);
45 var textareas = el.find('textarea'),
47 if(textareas.length === 1) {
48 to_push = el.find('textarea').val();
51 textareas.each(function() {
52 var textarea = $(this);
53 to_push.push({'id': textarea.attr('data-field-id'), 'text': textarea.val()});
56 push_answer(el, to_push);