forked from ArianaHernandez/where-its-at
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
58 lines (56 loc) · 1.64 KB
/
script.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
$(document).ready(function() {
$("#userBorough").keypress(function(e) {
var key = e.which;
if (key == 13) {
// the enter key code
var borough = $("#userBorough").val();
sessionStorage.setItem("borough", borough);
$(window).attr(
"location",
"https://where-its-at.glitch.me/experiences.html"
);
}
});
$("#submit").click(function() {
var borough = $("#userBorough").val();
sessionStorage.setItem("borough", borough);
$(window).attr(
"location",
"https://where-its-at.glitch.me/experiences.html"
);
});
});
var borough = sessionStorage.getItem("borough");
if (borough === "queens" || borough === "Queens") {
$("#borough").text("Queens");
$(".brooklyn").hide();
$(".manhattan").hide();
$(".bronx").hide();
$(".statenIsland").hide();
} else if (borough === "Brooklyn" || borough === "brooklyn") {
$("#borough").text("Brooklyn");
$(".queens").hide();
$(".manhattan").hide();
$(".bronx").hide();
$(".statenIsland").hide();
} else if (borough === "Staten Island" || borough === "staten island") {
$("#borough").text("Staten Island");
$(".queens").hide();
$(".manhattan").hide();
$(".bronx").hide();
$(".brooklyn").hide();
} else if (borough === "Bronx" || borough === "bronx") {
$("#borough").text("Bronx");
$(".queens").hide();
$(".manhattan").hide();
$(".statenIsland").hide();
$(".brooklyn").hide();
} else if (borough === "Manhattan" || borough === "manhattan") {
$("#borough").text("Manhattan");
$(".queens").hide();
$(".bronx").hide();
$(".statenIsland").hide();
$(".brooklyn").hide();
} else {
$("#borough").text("New York");
}