well guys, i have this function that checks for the value of two text-boxes and depending on whether they are equal or not, does specific things, here is the function:
function ajx()
{
var e_value = document.getElementById('email').value;
var text_value = document.getElementById('text2').value;
try{
if (e_value == text_value)
{
document.getElementById('email').style.border = '2px solid red';
document.getElementById('mes').innerHTML = 'email has been taken';
}
else if (e_value == "" || e_value == " "|| e_value.includes('@') == false|| e_value.includes('.') == false)
{
document.getElementById('email').style.border = '2px solid none';
document.getElementById('mes').innerHTML = '';
}
else{
document.getElementById('email').style.border = '2px solid blue';
document.getElementById('mes').innerHTML = '';
}
}
catch(e)
{
document.write(e);
}
}
the main problem i am having here is that this code:
document.getElementById('email').style.border = '2px solid none';
only works when i click outside the text-box, is it possible to make it work whiles the cursor is inside the text-box(on-focus), and how can i archive it? thanks !!!
this is the html:
<div class="wrap-input100 validate-input" data-validate = "Valid email is required: [email protected]">
<input class="input100 climate" type="email" name="email" placeholder="Email" id="email" onkeydown="ajx()" onmousemove="ajx();" onmouseover="ajx();" oninput="ajx();">
<label id="mes" style="color: red;" ></label>
</div>