@sherwood_littel Используйте .val() метод в jQuery, чтобы проверить input значение на пустоту, посмотрите ниже небольшой пример кода:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<html> <head> <script src="https://code.jquery.com/jquery-2.2.4.js"></script> </head> <body> <label for="username">Имя пользователя: </label> <input type="username" id="username" value=""/> </body> <script> $("body").on("input", "#username", function () { if ($("#username").val() === "") { console.log("Input значение пустое") } else { console.log("Input значение НЕ пустое") } }) </script> </html> |