Is this possible? #2

User 2018970 Photo


Registered User
11 posts

Is it possible to have a form display a dynamic message based on the day of the week. What I want to do is have a message displayed on Wednesday of every week but not on any other day.
User 187934 Photo


Senior Advisor
18,665 posts
Online Now

Hi Bradley,
Yes this can be done with php or Jquery. Here's the Jquery method. Change the myid to the actual id of the item your hiding or showing.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var jQ = $.noConflict(true);
// version 1
jQ(document).ready(function () {
//day == Sun=0, Mon=1, Tues=2, Wed=3, Thurs=4, Fri=5, Sat=6
var d = new Date();
var dayOfWeek = d.getDay();
if (dayOfWeek == 3) {
jQ('#myid').show();
}
else {
jQ('#myid').hide();
}
});
</script>
<div id="myid">Today is Wednesday</div>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
https://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.