$(document).ready(function() { $('#project').blur(function () { if ($(this).val() == '') { $('#project_name').text(''); } else { const pcode = getLocalCache('project_code'); if ($(this).val() !== pcode) { const pc = $(this).val(); $.ajax({ type: 'get', url: '/project/name', data: { code: pc }, dataType: 'json', success: function (result) { setLocalCache('project_code', pc); if (result.err === 1) { $('#project_name').text(''); $('#forget-project').val(''); toast(result.msg, 'error', 'exclamation-circle'); } else { $('#project_name').text(result.data); } } }) } } }); $('input').focus(function () { if($(this).hasClass('is-invalid')) { $(this).removeClass('is-invalid'); $(this).siblings('div.invalid-feedback').html(''); } }); });