Issue with .innerHTML, When tested on Scrimba, it says error in setting attributes to null bu |
Issue with .innerHTML, When tested on Scrimba, it says error in setting attributes to null bu |
dkar_0029 |
Nov 17 2021, 01:40 PM
Post
#1
|
Group: Members Posts: 5 Joined: 17-November 21 Member No.: 28,175 |
I want to replace the "No students enrolled" with the output from displayStudents(testArray) when it runs. I have attached the .js and .html files for reference.
Thanks! Attached File(s) assignment_1a.zip ( 1.48k ) Number of downloads: 218 |
Christian J |
Nov 17 2021, 03:12 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
Seems to work for me. But the subject line of your forum topic is truncated, what is it meant to say?
|
dkar_0029 |
Nov 17 2021, 03:21 PM
Post
#3
|
Group: Members Posts: 5 Joined: 17-November 21 Member No.: 28,175 |
Seems to work for me. But the subject line of your forum topic is truncated, what is it meant to say? Wait, what, so there is no issue with my code? Interesting... been looking at it for a long time lol Right, yes, the topic, let me show u instead. Attached thumbnail(s) |
Christian J |
Nov 17 2021, 03:51 PM
Post
#4
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
Could it be due to
CODE studentEnrolSummaryRef.innerHTML = displayStudents(studentList); that uses the empty studentList array? |
dkar_0029 |
Nov 17 2021, 04:06 PM
Post
#5
|
Group: Members Posts: 5 Joined: 17-November 21 Member No.: 28,175 |
Could it be due to CODE studentEnrolSummaryRef.innerHTML = displayStudents(studentList); that uses the empty studentList array? Nope, I have been testing a simplified version that doesn't work either Attached File(s) Simplified.zip ( 1.18k ) Number of downloads: 202 |
dkar_0029 |
Nov 17 2021, 09:48 PM
Post
#6
|
Group: Members Posts: 5 Joined: 17-November 21 Member No.: 28,175 |
|
dkar_0029 |
Nov 18 2021, 12:28 AM
Post
#7
|
Group: Members Posts: 5 Joined: 17-November 21 Member No.: 28,175 |
Could it be due to CODE studentEnrolSummaryRef.innerHTML = displayStudents(studentList); that uses the empty studentList array? Nope, I have been testing a simplified version that doesn't work either UPDATE - I FOUND IT! Attached thumbnail(s) |
Brian Chandler |
Nov 18 2021, 01:08 AM
Post
#8
|
Jocular coder Group: Members Posts: 2,476 Joined: 31-August 06 Member No.: 43 |
The answer is "debugging". Instead of staring endlessly at stuff trying to see the problem (which doesn't work), you put in debugging stuff. If the script file doesn't seem to be running, put "alert('fish');" near the beginning. You will immediately know when and whether it is being called.
|
Christian J |
Nov 18 2021, 10:44 AM
Post
#9
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
UPDATE - I FOUND IT! That doesn't explain the javascript errors though, a broken path to the JS file would prevent the script from running at all. I wouldn't worry about Scrimba though, use your web browsers' developer tools instead (both Firefox and Chromium-based). And like Brian said, methodical debugging is the key... |
Lo-Fi Version | Time is now: 25th September 2024 - 08:10 AM |