I want to verify in JavaScript that my required fields are not blank

前端 未结 3 1892
遥遥无期
遥遥无期 2021-01-25 02:03

Hopefully this is basic JavaScript and the answer is easy since I am new at this. I just want to make sure all required fields are not blank before the user can proceed. In my <

3条回答
  •  情深已故
    2021-01-25 02:33

    There are a couple issues here:

    cn1 = 'child_name'+document.getElementById('child_name').value;
    

    In this case you are assigning cn1 to the String 'child_name' + the value of your child_name textbox... it will never equal an empty String.

    Secondly, you'll want your insert() method to return false on error in order to stop the button's intended action.

提交回复
热议问题