From 7d5c472250bff427fa756938ea8a4125da714925 Mon Sep 17 00:00:00 2001
From: chawei217 <40185158+chawei217@users.noreply.github.com>
Date: Sat, 4 Apr 2020 21:05:48 -0700
Subject: [PATCH 1/6] Update script.js
---
1-0/script.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/1-0/script.js b/1-0/script.js
index f0aba22..b846bcd 100644
--- a/1-0/script.js
+++ b/1-0/script.js
@@ -1,3 +1,3 @@
-$(documnt).ready(function {
+$(document).ready(function() {
alert("congratulations, you fixed it!');
-});
\ No newline at end of file
+});
From 15b6a168ed0ae1a62ef0469a41c44796ce9919a3 Mon Sep 17 00:00:00 2001
From: unknown
Date: Sat, 4 Apr 2020 21:08:49 -0700
Subject: [PATCH 2/6] Fixed scope issue with masterLocation
---
2-1/script.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/2-1/script.js b/2-1/script.js
index 4d98451..d5779ed 100644
--- a/2-1/script.js
+++ b/2-1/script.js
@@ -5,11 +5,12 @@ $._get = function(url, callback) {
})
}
+
$(document).ready(function() {
var masterLocation;
var search_term = 'devmountain';
function setupApi() {
- var masterLocation = 'http://devmounta.in?q='+search_term;
+ masterLocation = 'http://devmounta.in?q='+search_term;
$(document).ajaxError(function(e, xhr, settings, thrown) {
console.log("Ajax ERROR", xhr, settings, thrown);
})
From a682772fed5a6f63f998d24fd7fdc08d05ec3991 Mon Sep 17 00:00:00 2001
From: Allen Zhang <1124796703@qq.com>
Date: Sat, 4 Apr 2020 21:12:34 -0700
Subject: [PATCH 3/6] Patched 2-1
---
2-1/script.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/2-1/script.js b/2-1/script.js
index 4d98451..9e63236 100644
--- a/2-1/script.js
+++ b/2-1/script.js
@@ -9,7 +9,7 @@ $(document).ready(function() {
var masterLocation;
var search_term = 'devmountain';
function setupApi() {
- var masterLocation = 'http://devmounta.in?q='+search_term;
+ masterLocation = 'http://devmounta.in?q='+search_term;
$(document).ajaxError(function(e, xhr, settings, thrown) {
console.log("Ajax ERROR", xhr, settings, thrown);
})
@@ -17,7 +17,7 @@ $(document).ready(function() {
setupApi();
$._get(masterLocation, function(data) {
$.each(data.results, function(index, tweet) {
- $('#results').append(' '+this.tweet+'
');
+ $('#results').append(' '+tweet+'
');
});
});
});
\ No newline at end of file
From f6a4eac240f4ab3c62dcbc057e678e2370b3b2f6 Mon Sep 17 00:00:00 2001
From: Allen Zhang <1124796703@qq.com>
Date: Sat, 4 Apr 2020 21:15:34 -0700
Subject: [PATCH 4/6] Patched 2-0
---
2-0/script.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/2-0/script.js b/2-0/script.js
index 9e6d550..845818b 100644
--- a/2-0/script.js
+++ b/2-0/script.js
@@ -22,13 +22,13 @@ $(document).ready(function() {
}
];
for (var i = 0; i
");
+ if (data[i].text) {
+ $('#news').append("");
}
}
$("button").click(function() {
- if (!this.attr('data-href')) {
- document.location = this.attr('data-href');
+ if (!$("button").attr('data-href')) {
+ document.location = $("button").attr('data-href');
}
});
});
\ No newline at end of file
From d8d2c9e78754ff0aa9162483e77d766690ea5360 Mon Sep 17 00:00:00 2001
From: chawei217 <40185158+chawei217@users.noreply.github.com>
Date: Sat, 4 Apr 2020 21:16:11 -0700
Subject: [PATCH 5/6] Update script.js
---
1-0/script.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1-0/script.js b/1-0/script.js
index b846bcd..a7b071e 100644
--- a/1-0/script.js
+++ b/1-0/script.js
@@ -1,3 +1,3 @@
$(document).ready(function() {
- alert("congratulations, you fixed it!');
+ alert("congratulations, you fixed it!");
});
From 21b47a9ea3713ca6c611b0344d1c0ba112b20fde Mon Sep 17 00:00:00 2001
From: Allen Zhang <1124796703@qq.com>
Date: Sat, 4 Apr 2020 21:29:01 -0700
Subject: [PATCH 6/6] Patched 3-0
---
3-0/index.html | 4 ++--
3-0/script.js | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/3-0/index.html b/3-0/index.html
index b3c06f7..d02772e 100644
--- a/3-0/index.html
+++ b/3-0/index.html
@@ -6,7 +6,7 @@
-
+
Javascript Debugging Exercise 3-0
Find and fix the jQuery errors.
@@ -14,7 +14,7 @@
Javascript Debugging Exercise 3-0
Click the list items until they reach 0 in number
-
+
-
4
Cras justo odio
diff --git a/3-0/script.js b/3-0/script.js
index cd2022a..4bbb53d 100644
--- a/3-0/script.js
+++ b/3-0/script.js
@@ -1,12 +1,12 @@
$(document).ready(function() {
- $('.list-group-items').click(function() {
- $(this).find('span', function(span) {
- var num = Number($(this).html());
+ $('.list-group-item').click(function() {
+ $(this).each(function(span) {
+ var num = Number($(this).find('span').html());
num--;
if (num <= 0) {
num = '';
}
- $(this).html = num;
+ $(this).find('span').html(num);
})
});
});
\ No newline at end of file