When the dialog called, a window appears and closes immediately, the question is how to prevent it from closing?

 var date=$('input[type="text"]'); $('form').find('input[type="submit"]').on('click',function (){ if (date.val()==""){ alert('Строка пустая') } else { $( function() { $("#dialog").dialog(); } ); } }) 
  • Is a form being submitted? - Mihanik71
  • If you are given an exhaustive answer, mark it as correct (tick next to the selected answer) - Mihanik71

1 answer 1

You do not interrupt the current submit action.

 var date=$('input[type="text"]'); $('form').find('input[type="submit"]').on('click',function (){ if (date.val()==""){ alert('Строка пустая') } else { $( function() { $("#dialog").dialog(); } ); } return false; })