'Change css with if statement without submitting button
I am creating an user register form with usernames just like Instagram where the website automatically checks if your input (username) already exists in the database and if it exists its changing the css after a second by example a font awesome icon checked and font awesome icon cross / times, how can i do this without using a submit button?
the code i have now is:
<form method="post"> <div class="field">
<span class="fas fa-user"></span>
<input name="email" required type="text" value="<?php if(isset($_COOKIE["email"])) { echo $_COOKIE["email"]; } ?>">
<label>Username</label>
<span id="<?php **wait 1 second and if input (username) is in database change the css to "cross" else if username is not in database change the css to "checked" ** ?>"></span>
</div> </form>
so the part I need help with is defining the input so i can check it without the use of a submit button. I do not need helping with checking in the database and changing the css state
Solution 1:[1]
I would do something like this:
string foo = IsBar ? "..." : null;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Natalia Muray |
