The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Issue with .innerHTML, When tested on Scrimba, it says error in setting attributes to null bu
dkar_0029
post 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)
Attached File  assignment_1a.zip ( 1.48k ) Number of downloads: 205
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 17 2021, 03:12 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,628
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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
dkar_0029
post Nov 17 2021, 03:21 PM
Post #3





Group: Members
Posts: 5
Joined: 17-November 21
Member No.: 28,175



QUOTE(Christian J @ Nov 17 2021, 03:12 PM) *

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)
Attached Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 17 2021, 03:51 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



Could it be due to

CODE
studentEnrolSummaryRef.innerHTML = displayStudents(studentList);

that uses the empty studentList array?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
dkar_0029
post Nov 17 2021, 04:06 PM
Post #5





Group: Members
Posts: 5
Joined: 17-November 21
Member No.: 28,175



QUOTE(Christian J @ Nov 17 2021, 03:51 PM) *

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)
Attached File  Simplified.zip ( 1.18k ) Number of downloads: 187
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
dkar_0029
post Nov 17 2021, 09:48 PM
Post #6





Group: Members
Posts: 5
Joined: 17-November 21
Member No.: 28,175



QUOTE(Christian J @ Nov 17 2021, 03:12 PM) *

Seems to work for me. But the subject line of your forum topic is truncated, what is it meant to say?

Could u show me what it looks like for you when you run it?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
dkar_0029
post Nov 18 2021, 12:28 AM
Post #7





Group: Members
Posts: 5
Joined: 17-November 21
Member No.: 28,175



QUOTE(dkar_0029 @ Nov 17 2021, 04:06 PM) *

QUOTE(Christian J @ Nov 17 2021, 03:51 PM) *

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)
Attached Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Nov 18 2021, 01:08 AM
Post #8


Jocular coder
********

Group: Members
Posts: 2,460
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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 18 2021, 10:44 AM
Post #9


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



QUOTE(dkar_0029 @ Nov 18 2021, 06:28 AM) *

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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 05:33 AM