-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackUPapplication.js
151 lines (130 loc) · 5.49 KB
/
BackUPapplication.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//=require jquery
//=require jquery_ujs
//= require_tree .
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(function(){
$("#question_type_normal").click(function(){
$("#questions").show();
$(".clonedInput").hide();
$("#hidebtnm").hide();
}); //normal text box show
$("#question_type_Measurement").click(function(){
$("#questions").hide();
$("#hidebtnm").show();
$(".clonedInput").show();
$("#txtbtnkcinput1").show();
$("#hidebtnm").show();
});//quesiton_type_Measurement
$("#question_sequence_rbbkt").click(function(){
$("#textboxkc1").show();
$("#btntextkcadd").show();
$("#btntextkcdel").show();
$("#textbinsize1").hide();
$("#hidebs").hide();
$("#hidekc").show();
});//quesiton_sequence_Measurement
$("#question_sequence_rbdtree").click(function(){
$(".tobeclonedtextbinsize").show();
$("#btntextaddbinsize").show();
$("#btntextdelbinsize").show();
$("#hidekc").hide();
$("#hidebs").show();
$(".tobeclonedtextkc").hide();
});//quesiton_sequence_
$("#btnadd").click(function(){
$(".clonedInput").show();
}); //
$('#btntextkcadd').click(function() {
$(".tobeclonedtextkc").show();
var num = $('.tobeclonedtextkc').length; // how many "duplicatable" input fields we currently have
var newNum = new Number(num + 1); // the numeric ID of the new input field being added
var newElem = $('#textboxkc' + num).clone().attr('id', 'textboxkc' + newNum);
newElem.children('#kcs'+num).attr('id', 'kcs' + newNum ).attr('name', 'kcs' + newNum );
$('#textboxkc' + num).after(newElem);
if (num >= 1){
$("#btntextkcdel").attr("disabled", false );
}
});
$('#btntextkcdel').click(function() {
var num = $('.tobeclonedtextkc').length; // how many "duplicatable" input fields we currently have
$('#textboxkc' + num).remove(); // remove the last element
$('#btntextkcadd').attr('disabled', false );
if (num-1 == 1){
$('#btntextkcdel').attr('disabled', true);
}
});
$('#btnadd').click(function() {
var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have
var newNum = new Number(num + 1); // the numeric ID of the new input field being added
var newElem = $('#txtbtnkcinput' + num).clone().attr('id', 'txtbtnkcinput' + newNum);
newElem.children('#sp'+num).attr('id', 'sp' + newNum ).attr('name', 'sp' + newNum );
newElem.children('#ep'+num).attr('id', 'ep' + newNum ).attr('name', 'ep' + newNum );
newElem.children('#fp'+num).attr('id', 'fp' + newNum ).attr('name', 'fp' + newNum );
newElem.children('#answer'+num).attr('id', 'answer' + newNum ).attr('name', 'answer'+ newNum );
$('#txtbtnkcinput' + num).after(newElem);
if (num >= 1){
$("#btnDel").attr("disabled", false );
//$("#btnDel").disable();
}
});
$('#btnDel').click(function() {
var num = $('.clonedInput').length;
$('#txtbtnkcinput' + num).remove();
$('#btnadd').attr('disabled', false );
if (num-1 == 1)
$('#btnDel').attr('disabled','disabled');
});
$('#btntextaddbinsize').click(function() {
$(".tobeclonedtextbinsize").show();
var num = $('.tobeclonedtextbinsize').length;
var newNum = new Number(num + 1);
var newElem = $('#textbinsize' + num).clone().attr('id', 'textbinsize' + newNum);
newElem.children('#binsize' + num).attr('id', 'binsize' + newNum).attr('name', 'binsize' + newNum);
$('#binsize' + num).after(newElem);
if (num >= 1){
$("#btntextdelbinsize").attr("disabled", false );
}
});
$('#btntextdelbinsize').click(function() {
var num = $('.tobeclonedtextbinsize').length;
$('#textbinsize' + num).remove();
$('#btntextaddbinsize').attr('disabled', false);
if (num-1 == 1){
$('#btntextdelbinsize').attr('disabled','disabled');
}
});
$("#question_sequence_random").click(function(){
$(".tobeclonedtextkc").hide();
$(".tobeclonedtextbinsize").hide();
$('#btntextkcadd').hide();
$('#btntextkcdel').hide();
$("#btntextaddbinsize").hide();
$('#btntextdelbinsize').hide();
});
$("#question_sequence_random_once").click(function(){
$(".tobeclonedtextkc").hide();
$(".tobeclonedtextbinsize").hide();
$('#btntextkcadd').hide();
$('#btntextkcdel').hide();
$("#btntextaddbinsize").hide();
$('#btntextdelbinsize').hide();
});
$("#question_sequence_as_in_instruction_set").click(function(){
$(".tobeclonedtextkc").hide();
$(".tobeclonedtextbinsize").hide();
$('#btntextkcadd').hide();
$('#btntextkcdel').hide();
$("#btntextaddbinsize").hide();
$('#btntextdelbinsize').hide();
});
$('#btntextdelbinsize').attr('disabled', true);
$('#btnDel').attr('disabled', true);
$('#btntextkcdel').attr('disabled', true);
});