There is html:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Войти в приложение</title> <link rel="stylesheet" type="text/css" href="./css/index.css"> <script src="./js/index.js"></script> </head> <body class="register-page"> <div class="register-auth"> <div class="error-1"></div> <div class="error-2"></div> <div class="register-auth-header-exit"> <div class="register-auth-title">Войти в приложение</div> </div> <form action=""> <input class="register-auth-input-error" placeholder="Заполните поле" type="text"> <input class="register-auth-input-error" placeholder="Неверный пароль" type="password"> <input class="register-auth-button-exit" type="submit" value="Войти"> </form> </div> </body> </html> var el = document.querySelector('.register-auth-input-error'); console.log(el);/*Возвращает null*/ returns null, and I need to add a class
el.classList.add("error"); if not difficult, send on the right path)
querySelectorAllcannot return null, since it returns a collection, and in the absence of elements that satisfy the selector, returns an empty collection - Grundy