in this case, the event of loss of focus does not work the first time. What could be the problem?

$(document).ready(function(){ $("#time_of_purchase").blur(function(){ var time_parts = $("#time_of_purchase").val().split(':'); if ((time_parts['0']>24)||(time_parts['1']>59)){ $('#btn_submit').attr('disabled', 'true'); } else { $('#btn_submit').removeAttr('disabled'); } }); }); 
  • Everything works for me the first time. Maybe you did not understand the problem and in fact the problem is that you are trying to compare a string with a number? - andreymal
  • To reduce the types of problems with string comparison and numbers should not be, they will both be compared as numbers. Most likely, the question is incorrectly formulated and the only thing I can assume is: Let's say if you write "24:60" in the field, then you can press the button and only after that it becomes inactive, but the query will still work (since the "submit" button) . Is my guess correct and do you see the problem in this? If not, then there seems to be no other problems that I observe that could affect the response from the first time. - MedvedevDev

0