Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the null message input in contact form #818

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions assets/contact/contact.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ button:hover {
background: #ff6984;
}

button:disabled{
cursor: not-allowed;
pointer-events: none;
transition: none;

}

/*----------------------------------------------- Updated Footer Styling ---------------------------------------*/
.footer-basic {
padding: 40px 0;
Expand Down
2 changes: 1 addition & 1 deletion assets/contact/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h2>Contact Us</h2>
<label for="message">Your Message:</label>
<textarea id="message" name="message" rows="5" placeholder="Enter Your Message" required></textarea>

<button type="submit">Send Message</button>
<button type="submit" id="button" disabled>Send Message</button>
</form>
</section>
</div>
Expand Down
11 changes: 11 additions & 0 deletions assets/contact/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ function validateName(inputId) {
}
}

const message=document.querySelector("#message");
const btn=document.querySelector("#button");
message.addEventListener("input",validate);
function validate(){
if (message.value===""){
btn.setAttribute("disabled","disabled");
} else {
btn.removeAttribute("disabled");
}
}

const ham = document.querySelector(".hamburger");
const navMe = document.querySelector(".nav-menu");

Expand Down