search

Home  >  Q&A  >  body text

H5 form validation not supported by Chrome - Stack Overflow

required oninvalid="setCustomValidity('Please enter the product name');" oninput="setCustomValidity('');"

Use the above code in the form element. The id of the
form form is goodsForm

goodsForm.submit If used normally in Firefox, it will not be submitted if it is empty. If it is filled in correctly, it will be submitted. If Chrome prompts that it is not empty, it will still be submitted.
Please answer, thank you

仅有的幸福仅有的幸福2835 days ago472

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 13:00:42

    If it is judged to be empty and is not submitted, then add return false;

    reply
    0
  • Cancelreply