Is there a way to dynamically add a class to an input[type="email"] when its length is greater than 0 and remove it when the input length reaches 0?
I'm not very proficient in JavaScript, so the solution could be implemented using vue.js or pure JavaScript.
Despite attempting some examples found online, I have not been successful in finding a working solution.
<div class="form-group">
<input type="email" name="email" required>
<label for="email">Email</label>
</div>
- Add a class if the input length is greater than 0
- Remove the class if the input length equals 0