Skip to content

Commit 0d3ac86

Browse files
authored
Merge pull request #388 from zalabhavy/contact
Contact fix when submition
2 parents 9e4d26f + aed28aa commit 0d3ac86

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

website2.0/contactus.html

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,13 @@ <h1>Contact Us</h1>
112112
<form id="contact-form">
113113
<!-- <label for="name">Name:</label> -->
114114
<input type="text" id="name" name="name" required placeholder="Name:">
115-
116-
117-
115+
118116
<!-- <label for="email">Email:</label> -->
119117
<input type="email" id="email" name="email" required placeholder="Email:">
120-
121-
122-
118+
123119
<!-- <label for="comment">Comment:</label> -->
124-
<textarea id="comment" name="comment" required placeholder="Comment:" ></textarea>
125-
126-
127-
120+
<textarea id="comment" name="comment" required placeholder="Comment:"></textarea>
121+
128122
<label for="rating" id="rate">Rating:</label>
129123
<div id="rating">
130124
<span class="star" data-value="1">&#9733;</span>
@@ -133,11 +127,12 @@ <h1>Contact Us</h1>
133127
<span class="star" data-value="4">&#9733;</span>
134128
<span class="star" data-value="5">&#9733;</span>
135129
</div>
136-
130+
137131
<button type="submit" id="button">Submit</button>
132+
<p id="thank-you-message" style="color: white; display: none;">Thank you !!<br>We will connect soon.</p>
138133
</form>
139-
</div>
140-
</div>
134+
</div>
135+
</div>
141136
<div class="marg">
142137
<div class="footer">
143138
<p class="iconsclass mm">

website2.0/contactus.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ document.addEventListener("DOMContentLoaded", () => {
1111
}
1212
});
1313
});
14+
});
15+
document.getElementById('contact-form').addEventListener('submit', function(event) {
16+
event.preventDefault();
17+
18+
const thankYouMessage = document.getElementById('thank-you-message');
19+
thankYouMessage.style.display = 'block';
20+
21+
setTimeout(function()
22+
{
23+
thankYouMessage.style.display = 'none';
24+
document.getElementById('contact-form').reset();
25+
}, 3000);
1426

15-
const form = document.getElementById("contact-form");
16-
form.addEventListener("submit", (e) => {
17-
e.preventDefault();
18-
alert(
19-
`Name: ${form.name.value}\nEmail: ${form.email.value}\nComment: ${form.comment.value}\nRating: ${selectedRating} stars`
20-
);
21-
});
2227
});

0 commit comments

Comments
 (0)