5 $('form').submit(function(e) {
9 $('.exercise-wtem').each(function() {
11 if(el.hasClass('exercise')) {
14 var type = el.attr('data-type');
20 $('input[name=answers]').val(JSON.stringify(to_submit));
23 var push_answer = function(el, answer) {
24 to_submit[el.attr('data-id')] = answer
28 edumed: function(el) {
29 var exercise = el.data('exercise'),
32 if(exercise.get_answers) {
33 to_push.closed_part = exercise.get_answers()[0];
35 open_part = el.find('.open_part')
36 if(open_part.length) {
37 to_push.open_part = open_part.find('textarea').val();
40 push_answer(el, to_push);
44 var textareas = el.find('textarea'),
46 if(textareas.length === 1) {
47 to_push = el.find('textarea').val();
50 textareas.each(function() {
51 var textarea = $(this);
52 to_push.push({'id': textarea.attr('data-field-id'), 'text': textarea.val()});
55 push_answer(el, to_push);