Change text according to days using JavaScript

<section class="hero bg-theme text-center">
  <div class="container">
<h2 id="dailyTitle" class="section-title h3 mb-2"></h2>
<p id="dailySubtitle" class="lead text-soft mb-3"></p>
<a href="https://soatechnology.net/ai/today-quote" class="btn btn-primary btn-lg">📜 उद्धरण</a>
  </div>
</section>
<script>
  const dailyTexts = [
    {
      title: "आज का प्रेरणादायक विचार",
      subtitle: "सकारात्मकता • जीवन • कर्म • प्रेरणा"
    },
    {
      title: "आज का शुभ संदेश",
      subtitle: "शांति • विश्वास • आत्म-चिंतन"
    },
    {
      title: "आज का सुविचार",
      subtitle: "प्रेरणा • आत्मविश्वास • सफलता"
    },
    {
      title: "आज का विचार",
      subtitle: "जीवन • अनुभव • सीख"
    },
    {
      title: "आज का संदेश",
      subtitle: "धैर्य • आशा • विश्वास"
    },
    {
      title: "आज की प्रेरणा",
      subtitle: "सपने • मेहनत • लक्ष्य"
    },
    {
      title: "आज का जीवन मंत्र",
      subtitle: "कर्म • संतुलन • सकारात्मक सोच"
    }
  ];

  const today = new Date().getDay(); // 0–6
  const text = dailyTexts[today];

  document.getElementById("dailyTitle").innerText = text.title;
  document.getElementById("dailySubtitle").innerText = text.subtitle;
</script>

Comments

Leave a Reply