There is a script that stops sending the form if the text field is empty.
How to make it so that if the field is empty - the form was not sent, and the textarea was made active (that is, as when clicking on it)?
From comments:
How to make more lines to turn red, but if they just clicked, they were normal?
Here is the code:
$('form').submit(function(){ // Если textarea пустое if(!$(this).find('textarea').val()){ // отменяем отправку return false; } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form action='page' method='POST'> <textarea></textarea><br><input type='submit'> </form>