Arturo Simon• 1,785
@artimys
Posted
Nice Job!! A few suggestions to improve your JS.
-
remove duplicate
<p class="warning-message2>
tag which would do away with checking window.innerWidth (see code below) -
create a class (call it .error) on your form to style the errors. This class would style the input red border and display the message. Add/ remove class with JS instead of changing multiple styles
- wrap input and button in its own div
- style the div so it stacks on mobile and floats next to each other in desktop
<form id="form">
<div class="input-group">
<input type="email" placeholder="Your email address..." id="email">
<p class='warning-message1'>Please provide a valid email address</p>
</div>
<div class="input-group">
<button id="notify-me" type="button">Notify Me</button>
</div>
</form>
Keep on coding!!
1