Ask coding questions

← Back to all posts
How to detect if element's style contains "display: none;"?
RixTheTyrunt

Well, I forgot what is the thing before i get asking, so pleeaassee don't be kinda angrily... Well, I want to detect if the element's with a id "senderName" style contains "display: none;", so please halp me.

Answered by MikeW3 [earned 5 cycles]
View Answer
Voters
RixTheTyrunt
Comments
hotnewtop
MikeW3

if (document.getElementById("senderName").style.display === "none") {// Stuff}

MikeW3

I forked your project and fixed all the bugs
https://replit.com/@MikeW3/LOLSpace-fork

MikeW3

@MikeW3 You could copy the code back into your project if you want

MikeW3

@MikeW3 I updated it do you like it?

MikeW3

Also
https://lolspace.snackyplusplus.repl.co/chat.html
loads forever for some reason

RixTheTyrunt

Hmm, yeah, because of a bug, I am fixing right now in this morning, I thinked of a such workaround ( Ugh, no not just walking and doing my work around... I don't even have one! XD ) and then I am gonna try it today!

MikeW3

@SnackyPlusPlus how do you do that, like it totally crashes the page and I cant even open devtools, it must be a huge bug

MikeW3

@MikeW3 I found it: its because of the while loop that never ends

MikeW3

@MikeW3 Also,

code does not even work and it just generates errors in the console

MikeW3

@MikeW3 Also, there is a bug where it renders messages you sent as raw html "<p></p> <p>Test Message</p>"
also it does not print the name

RixTheTyrunt

No no, it's just the Font Awesome icons!

JustCoding123

This should do it: document.getElementById("senderName").style.display == "none"

JustCoding123

@MikeW3 I thought he can put the condition in an if statement himself. And == doesn't set anything.

MikeW3

@JustCoding123 wait nevermind i thought you put =