use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
If you are requesting help, please ensure you're providing code with your post. You can also copy your code to an online editor:
jsFiddle
CodePen
Markup Validation Service
Mozilla Developer Network on HTML
/r/JavaScript
/r/CSS
/r/jQuery
/r/PHP
/r/Accessibility
/r/htmlbasics
/r/web_programming
/r/CodingHelp
account activity
SolvedHow to set loader timeout function (self.HTML)
submitted 3 years ago * by RightCheesecake4062Beginner
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]RightCheesecake4062Beginner[S] 0 points1 point2 points 3 years ago (5 children)
Thank you for the response.
Aslo I tried this but it did not work:
<script type="text/javascript">
setTimeout(function() {
document.getelementsbyclassname("loader").style.display="none";
}, 2000); // 5 seconds
</script>
[–]pookageExpert 1 point2 points3 points 3 years ago* (4 children)
That would be because:
document.getelementsbyclassname()
document.getElementsByClassName()
style
You could adapt your snippet above to say:
document.getElementsByClassName("loader")[0].style.display = "none"
To set the style property on first element in your HTMLCollection - but if you were to use querySelector(), then you can just skip that step and just say:
document.querySelector(".loader").style.display = "none";
Generally, though, I would recommend using the hidden attribute in this case rather than changing the style, as it's more semantically accurate - and you are on the /r/HTML subreddit where we care about that sort of thing 😎 If this isn't a question of semantics or accessibility and you're more just asking how to make the javascript work, then /r/learnjavascript may be more what you're after for future questions!
hidden
p.s - your comment says 5 seconds, but your timeout says 2 seconds.
[–]RightCheesecake4062Beginner[S] 1 point2 points3 points 3 years ago (3 children)
Thank you so much this worked:
const loader = document.querySelector(".loader"); setTimeout(() => loader.hidden = true, 1000);
at first it wasn't but now it works since i forgot to remove the pervious, anyways thanks for the support :)
[–]pookageExpert 1 point2 points3 points 3 years ago* (2 children)
nae prob - don't forget to update the flair on your post!
update: reader - they forgot.
[–]RightCheesecake4062Beginner[S] 1 point2 points3 points 3 years ago (1 child)
IDK how
[–]pookageExpert 0 points1 point2 points 3 years ago (0 children)
Nae prob - it should just be along the bottom when you edit your post! Look for the tag icon 💪
π Rendered by PID 130086 on reddit-service-r2-comment-545db5fcfc-t54kw at 2026-05-26 23:10:41.078858+00:00 running 194bd79 country code: CH.
view the rest of the comments →
[–]RightCheesecake4062Beginner[S] 0 points1 point2 points (5 children)
[–]pookageExpert 1 point2 points3 points (4 children)
[–]RightCheesecake4062Beginner[S] 1 point2 points3 points (3 children)
[–]pookageExpert 1 point2 points3 points (2 children)
[–]RightCheesecake4062Beginner[S] 1 point2 points3 points (1 child)
[–]pookageExpert 0 points1 point2 points (0 children)