Ask coding questions

← Back to all posts
Your function doesn't execute
RixTheTyrunt

Hi, I inserted the ( maybe ) correct code for dark mode, but it does not exexcute. Why does repl.it do that? Why it cannot execute?!

Comments
hotnewtop
firefish

i thought you'd've learnt your lesson by now...

RixTheTyrunt

@firefish Because I didn't find anything!

xfinnbar

I think he uses translator and is also mentally challenged. @firefish

firefish

I think he uses translator and is also mentally challenged. @firefish

@xfinnbar seems a plausible explanation

RixTheTyrunt
firefish
Coder100

because your code is wrong look at line 13 you never finished the expression statement??

also document.hr.style is not a thing, you have to actually get the element, for example: document.querySelector("hr")

xfinnbar

Your code is wrong. Use this instead:

RixTheTyrunt

@xfinnbar make a else thingy if NOT dark mode

RixTheTyrunt

@xfinnbar What do you mean with localstorage in your code? Did you forgot to make a let localstorage = "..." thingy?

xfinnbar

@SnackyPlusPlus The default styles will apply. You can overwrite them in dark mode.

RixTheTyrunt

@xfinnbar I want to add the style for a div element with a class code ( div.code )

xfinnbar

@SnackyPlusPlus localStorage is built-in to your browser. You do not have to declare it. It's like document.

xfinnbar

@SnackyPlusPlus At the top of your CSS, write this:

Then, in the dark theme code, where I typed "// add more styles here if you like." write

RixTheTyrunt

Oh, it still doesn't execute