Skip to content

Commit

Permalink
Fixed the script redundancy in form submission, reformatting it into …
Browse files Browse the repository at this point in the history
…one script
  • Loading branch information
rielara committed Oct 2, 2024
1 parent 734f296 commit 6310eff
Showing 1 changed file with 21 additions and 28 deletions.
49 changes: 21 additions & 28 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
<a href="#" class="logo">Swasthya<span>.</span></a>

<nav class="navbar">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About Us</a></li>
<li><a href="#services">Services</a></li>
<li> <a href="#contact">Contact</a></li>
<li> <a href="#blogs">Blogs</a></li>
<li><a href="nearby.html">Nearby</a></li>
</ul>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About Us</a></li>
<li><a href="#services">Services</a></li>
<li> <a href="#contact">Contact</a></li>
<li> <a href="#blogs">Blogs</a></li>
<li><a href="nearby.html">Nearby</a></li>
</ul>
</nav>

</header>
Expand Down Expand Up @@ -364,17 +364,20 @@ <h2 class="text-5xl text-sky-900 font-bold mb-6">Contact Us</h2>
</div>
</section>

<script>
document.getElementById('contactForm').addEventListener('submit', function (event) {
event.preventDefault(); // Prevents the form from being submitted to a server

// Show the confirmation message
document.getElementById('confirmationMessage').style.display = 'block';

// Clear form fields (optional)
// document.getElementById('contactForm').reset();
});
</script>
<script>
// JavaScript to handle form submission and display thank you message
document.getElementById('contactForm').addEventListener('submit', function (event) {
event.preventDefault(); // Prevent form from submitting

// Show thank you message
document.getElementById('confirmationMessage').style.display = 'block';
document.getElementById('thankYouMessage').style.display = 'block';

document.getElementById('contactForm').reset();
});
</script>


</main>
Expand All @@ -400,17 +403,7 @@ <h5>Aligarh</h5>
</div>
</div>
</footer>
<script>
// JavaScript to handle form submission and display thank you message
document.getElementById('contactForm').addEventListener('submit', function (event) {
event.preventDefault(); // Prevent form from submitting

// Show thank you message
document.getElementById('thankYouMessage').style.display = 'block';

document.getElementById('contactForm').reset();
});
</script>


<script> configObj = {
"buttonD": "M8 17.333h5.333v4C13.333 22.806 14.527 24 16 24c1.473 0 2.667-1.194 2.667-2.667v-4H24L16 8l-8 9.333z", "buttonT": "translate(-1088 -172) translate(832 140) translate(32 32) translate(224)",
Expand Down

0 comments on commit 6310eff

Please sign in to comment.