I'm making a website and I want to be able to make HTML elements which will hide themselves once it's a certain day (ie. I want elements that will "expire")
Anyone know how I would go about achieving this? Probably something with javascript?
Let's see them armpits and then we can talk
>>58533957
Use the Date class and a CSS display:none style
>>58533957
>>58534126
its install gentoo you massive faggot
OP, you're doing it wrong, you will hung up at every corner, just go learn xml basics, then html5, static css3, and javascript basic
should take you a week, then you can make your website in a day, your step-by-step problem solving will have you 2 months learning nothing and accomplishing very little
>>58533957
Javascript (client-side) is fine as long as hiding the elements is just for convenience. Users would potentially be able to see the hidden elements by tweaking the Javascript.
If users must not be able to see the hidden elements on a different day for whatever reason, you'll have to look in to server side scripting options (which could still involve Javascript if you use Node)
>>58534201
This.
>>58534126
Link to 25 js libraries including whatever library is the hot meme this week. Angular? React? Poo.js?
On the back end use a mix of SQL, ASP.NET web service calls, and PHP. Oh, and mix in some Ruby.
Don't forget to join 30 ad networks with tracking.
Your final page should require 30MB of downloads compressed and should randomly pop up and slide in ads and surveys.
You can do it easy with vanilla js retard.
For your usecase you might want to use PHP
I know, I know
>php
Alternatively send the html with the content you want from <insert your favorite backend server application>
Here's what I have so far
<p class="scoobs" date="1/16/2017">Hi</p>
<script>
var theDate = new Date();
var parsedDate = Date.parse(theDate);
var x = document.getElementsByClassName("scoobs");
for (i = 0; i < x.length; i++) {
var expireDate = Date.parse(x[i].getAttribute("date"));
if (theFullDateObject > expireDate) {
x[i].style.display = 'none';
}
}
</script>
It seems like it should work but for some reason it fails at the if statement. Is there something I'm missing?
>>58535320
>theFullDateObject
oops, this is actually parsedDate as it should be
nvm figured it out
>>58534389
>Angular? React? Poo.js?
It's Angular
it's so fucking bonerific when you bang your head against your computer for hours and then it does what you want it to do