search

Home  >  Q&A  >  body text

javascript - Click the submit button to check the values ​​of all inputs on the page and pop up a prompt if any one is empty

There are originally 5 inputs in the page. Clicking the "Add button" will add a new input to the page. When clicking the Submit button and any input is empty, it cannot be submitted and an alert prompt pops up. How to do this?

phpcn_u1582phpcn_u15822739 days ago480

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-05-19 10:19:02

    Use the valid plug-in, or read the data in a loop yourself. Once it is empty, alert immediately and return false, otherwise continue.

    reply
    0
  • Cancelreply