There are various writing methods for client-side JavaScript validation of forms. Log in to write a function for the form's onsubmit event or submit button. For small forms (forms with only one or two form fields), there is no need to write a verification function in JavaScript. You only need to add:
onsubmit="return domainname.value=="?(alert('Please enter the search content'),false):true ;"
With only one sentence, it realizes the function of submitting when the verification is successful and giving a prompt when it fails. The domainname is the name of the form field to be verified. Of course, when there are many form fields, It is not suitable to write like this when the verification process is complicated
.