There is a simple form
var inp = document.forms[0].send; inp.addEventListener('click', function(e) { e.preventDefault(); console.log('click'); }); <form action="/"> <input type="text" name="text" placeholder="Заполни меня" required> <input type="submit" name="send" value="Отправить"> </form> The problem is that when I call
e.preventDefault () - the browser cancels the action of checking for the contents of a tag that has required installed. And even if it is empty - it skips.
That is the question, is it really possible not to cancel this action? Or just write a function to check the contents?