|
1 | 1 | $(function() { |
2 | | - if ($('#demographic_info_after_graduation').val() !== "I intend to start a new in-field job within 180 days of graduating the program.") { |
3 | | - $('#time_off').hide(); |
4 | | - } |
5 | | - if ($('#demographic_info_pronouns_other').prop('checked') === false) { |
6 | | - $('#pronouns_blank').hide(); |
7 | | - } |
8 | | - |
9 | | - $('#demographic_info_after_graduation').change(function() { |
10 | | - if ($(this).val() === "I intend to start a new in-field job within 180 days of graduating the program.") { |
11 | | - $('#time_off').show(); |
12 | | - } else { |
| 2 | + if ($('#new_demographic_info').length > 0) { |
| 3 | + COLLEGE_OR_HIGHER = ["associate's degree", "bachelor's degree", "master's degree", "doctoral degree or above", "other"]; |
| 4 | + if (!COLLEGE_OR_HIGHER.includes($('#demographic_info_education').val())) { |
| 5 | + $('#cs_degree').hide(); |
| 6 | + } |
| 7 | + if ($('#demographic_info_after_graduation').val() !== "I intend to start a new in-field job within 180 days of graduating the program.") { |
13 | 8 | $('#time_off').hide(); |
14 | 9 | } |
15 | | - }); |
16 | | - $('#demographic_info_pronouns_other').change(function() { |
17 | | - if ($('#demographic_info_pronouns_other').prop('checked') === true) { |
18 | | - $('#pronouns_blank').show(); |
19 | | - $('#demographic_info_pronouns_blank').focus(); |
20 | | - } else { |
| 10 | + if ($('#demographic_info_pronouns_other').prop('checked') === false) { |
21 | 11 | $('#pronouns_blank').hide(); |
22 | 12 | } |
23 | | - }); |
24 | 13 |
|
25 | | - // enforces numbers only; adds dashes in correct places |
26 | | - $('#demographic_info_ssn').keyup(function(event) { |
27 | | - var selection = window.getSelection().toString(); |
28 | | - if (selection !== '' || $.inArray( event.keyCode, [38,40,37,39,8] ) !== -1) { |
29 | | - return; // ignore arrow keys and backspace |
30 | | - } |
31 | | - var val = this.value.replace(/\D/g, ''); |
32 | | - var newVal = ''; |
33 | | - if(val.length > 4) { |
34 | | - this.value = val; |
35 | | - } |
36 | | - if((val.length > 3) && (val.length < 6)) { |
37 | | - newVal += val.substr(0, 3) + '-'; |
38 | | - val = val.substr(3); |
39 | | - } |
40 | | - if (val.length > 5) { |
41 | | - newVal += val.substr(0, 3) + '-'; |
42 | | - newVal += val.substr(3, 2) + '-'; |
43 | | - val = val.substr(5); |
44 | | - } |
45 | | - newVal += val; |
46 | | - if(newVal.length === 3 || newVal.length === 6) { |
47 | | - newVal += '-'; |
48 | | - } |
49 | | - this.value = newVal.substring(0, 11); |
50 | | - }); |
| 14 | + $('#demographic_info_education').change(function() { |
| 15 | + if (COLLEGE_OR_HIGHER.includes($(this).val())) { |
| 16 | + $('#cs_degree').show(); |
| 17 | + } else { |
| 18 | + $('#cs_degree').hide(); |
| 19 | + } |
| 20 | + }); |
| 21 | + $('#demographic_info_after_graduation').change(function() { |
| 22 | + if ($(this).val() === "I intend to start a new in-field job within 180 days of graduating the program.") { |
| 23 | + $('#time_off').show(); |
| 24 | + } else { |
| 25 | + $('#time_off').hide(); |
| 26 | + } |
| 27 | + }); |
| 28 | + $('#demographic_info_pronouns_other').change(function() { |
| 29 | + if ($('#demographic_info_pronouns_other').prop('checked') === true) { |
| 30 | + $('#pronouns_blank').show(); |
| 31 | + $('#demographic_info_pronouns_blank').focus(); |
| 32 | + } else { |
| 33 | + $('#pronouns_blank').hide(); |
| 34 | + } |
| 35 | + }); |
| 36 | + |
| 37 | + // enforces numbers only; adds dashes in correct places |
| 38 | + $('#demographic_info_ssn').keyup(function(event) { |
| 39 | + var selection = window.getSelection().toString(); |
| 40 | + if (selection !== '' || $.inArray( event.keyCode, [38,40,37,39,8] ) !== -1) { |
| 41 | + return; // ignore arrow keys and backspace |
| 42 | + } |
| 43 | + var val = this.value.replace(/\D/g, ''); |
| 44 | + var newVal = ''; |
| 45 | + if(val.length > 4) { |
| 46 | + this.value = val; |
| 47 | + } |
| 48 | + if((val.length > 3) && (val.length < 6)) { |
| 49 | + newVal += val.substr(0, 3) + '-'; |
| 50 | + val = val.substr(3); |
| 51 | + } |
| 52 | + if (val.length > 5) { |
| 53 | + newVal += val.substr(0, 3) + '-'; |
| 54 | + newVal += val.substr(3, 2) + '-'; |
| 55 | + val = val.substr(5); |
| 56 | + } |
| 57 | + newVal += val; |
| 58 | + if(newVal.length === 3 || newVal.length === 6) { |
| 59 | + newVal += '-'; |
| 60 | + } |
| 61 | + this.value = newVal.substring(0, 11); |
| 62 | + }); |
| 63 | + } |
51 | 64 | }); |
0 commit comments