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'); } }); });