-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo-tea.js
91 lines (61 loc) · 2.33 KB
/
demo-tea.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
$(function(){
$("#submit-success-radios").on("click",function(e){
$('.alert').slideUp(400);
$('#alert-info-radios').slideDown(400);
$("input").prop("disabled",true);
window.location = '#success';
});
//Button Alert Error - red
$("#submit-error-radios").on("click",function(e){
$('.alert').slideUp(400);
$('#alert-danger-radios').slideDown(400);
$("input").prop("disabled", false);
window.location = '#error';
});
//Button Alert Warning - yellow
$("#submit-warning-radios").on("click",function(e){
$('.alert').slideUp(400);
$('#alert-warning-radios').slideDown(400);
$( "input" ).prop( "checked", false );
$( "input" ).prop( "disabled", false );
window.location = '#oops';
});
$("#submit-feedback-radios").on("click",function(e){
$('.alert').slideUp(400);
$(".radio-wrapper").removeClass('radio-selected');
$('#radioA').closest(".radio").addClass('radio-danger');
$('#radioA').closest(".radio-wrapper").addClass('radio-selected');
$('#radioC').closest(".radio").addClass('radio-success');
$("#radioC").prop( "checked", true );
$("input").prop("disabled", true);
$('.alert-item-info-radios').slideDown(400);
window.location = '#feedback';
});
$(".nav-tabs a").on("click",function(e){
resetform();
});
$(".submit-reset-radios").on("click",function(e){
resetform();
});
function resetform(){
$('.alert').slideUp(400);
$('.radio').removeClass('radio-danger');
$('.radio').removeClass('radio-success');
$('.radio-wrapper').removeClass('radio-selected');
$("input").prop("checked", false);
$("input").prop("disabled", false);
}
$('form[name="alert-error"]').on("submit", function (e) {
console.debug('submit testing');
e.preventDefault(e);
var radios = document.getElementsByName("radios");
for(var i = 0; i < radios.length; i++) {
if(radios[i].checked == true) {
selectedRadio = radios[i].value;
console.debug('true' +selectedRadio);
} else {
console.debug('the radios are not selected');
}
}
});
});