I would like to know how to check whether something is entered in the input tag.
I mean, when registering an account, there is an asterisk on the names of something important, and if you skip, an error will pop up (this is already found, no need to answer). And if you write all the important fields in the form, it will be the opposite. For this I came here.

Code here: http://pastebin.com/GRBA4Mq7

    2 answers 2

    required - Sets the form field to be required before submitting the form to the server. If the required field is empty, the browser will display a message and the form will not be submitted.

     <input type="text" required /> 
    • Not quite good, because using the required attribute, we will not know which of the fields the user has filled in, for example, if we need to display the text of the error. It is also bad that in all browsers it will show an error in different ways. - Abmin Nov.
    • @Abmin so in the browser immediately gives a not filled field. - iKey
    • Personally, I do not use the required, because I want to display "You have not entered a name" or "Select a city". - Abmin Nov.
    • Thank! It all worked! - Wicopee

    You can check fields using javascript , for example: (jQuery code)

     if($("#myinput").val() == "") { alert("поле с id myinput пустое"); } 
    • I already found it, how to check whether something is entered at all in 3 fields, if yes, send a captcha reply. You explained if not. - Wicopee Nov.
    • @Wicopee, just as well, instead of == (equal), put != (Not equal) - Abmin
    • thanks too, use this in captcha. - Wicopee Nov.