@sliyarli
Posted
Your HTML and CSS code looks good for the most part, but I noticed a couple of issues and some room for improvements:
HTML Issues:
1 - In your HTML form, there are missing closing angle brackets (>
) for the input elements - For example:
<input type="text" placeholder="First Name" id="first"
Should be:
<input type="text" placeholder="First Name" id="first">
2 - The "Terms and Services" text within the <span>
in your HTML should be properly closed with </span>
- Update this part:
<p>
By clicking the button, you are agreeing to our <span> Terms and Services</span>
</p>
To:
<p>
By clicking the button, you are agreeing to our <span> Terms and Services</span>.
</p>
CSS Issues:
1 - There's a typo in the CSS for the box-sizing
property - It should be box-sizing
, but you have boz-sizing
:
*{
padding:0;
margin:0;
boz-sizing: border-box; /* should be box-sizing */
font-family: 'Poppins', sans-serif;
}
JavaScript Issues:
1 - There's a typo in your JavaScript code when checking the firstName
variable - You have:
var firstname = first.value.trim();
It should be consistent with your variable name:
var firstName = first.value.trim();
2 - In the JavaScript code, you have this block of code duplicated for first name validation:
if (firstName === ''){
errorFunc(first, 'First Name cannot be empty')
}
else {
successFunc(first)
}
You should replace the second successFunc(first)
with successFunc(last)
for the last name validation.
3 - In the successFunc
function, you should also remove the success
class when an input is in error state - You can do this by using classList.remove('success')
in addition to adding the error
class.
With these adjustments, your code should work correctly - Make sure to test it thoroughly to ensure everything is functioning as expected.
Marked as helpful