After successfully implementing a javascript validation using bootstrap to add the class is-invalid
when a field is null, I am now seeking a way to remove that class during the oninput
event.
For example:
<input type="text" name="emp_id" id="emp_id" oninput="rmv()">
<input type="text" name="emp_fn" id="emp_fn" oninput="rmv()">
In JavaScript:
function rmv(){
document.getElementsByClassName("is-invalid");
error.oninput = function(){
error.classList.remove('is-invalid');
}}
I have provided a simplified version of the code above. Please be aware that there are multiple text boxes with the validation is-invalid
class, and I only want to remove that class from the active textbox I am typing in. Thank you. (newbiee)