@fazzaamiarso
Posted
Hi @Leone-Ricardo! Nice solution and great addition!
I have some suggestion for you
- For Submit Button, it's better to use a
<button>
as it can have image, icons, elements, and text as a display value, whreas<input>
can only have text as value. So it become
// <button> by default have "submit" type
<button id="formSubmit" class="btn_submit">Claim your free trial</button>
- If you implemented the suggestion above, then you can also refactor the inputs looping like this.
// select all input elements
const inputElements = document.querySelectorAll("input");
// loop all input with forEach, where `inputEl` is the actual input element
inputElements.forEach((inputEl, idx) => {
inputEl.classList.remove("error");
formError[idx].style.display = "none";
//... other codes
})
I hope it helps! Cheers!
@Leone-Ricardo
Posted
Thanks for the feedback man! I wrote down your tip and I`ll try as soon as possible! Cheers! @fazzaamiarso