필수사항 체크

배고픈 징징이 ㅣ 2023. 1. 27. 11:24

class를 보고 필수사항을 체크해준다.

var checkOK = true;
function checkMust(){
	checkOK = true;
	
	$(".must").each(function(){
		if($(this).val().trim() == ""){
			checkOK = false;
			let th_name = $(this).parent().parent().find("th")[0].innerText;
			alert("필수항목 " + th_name + "를 입력하지 않으셨습니다.");
			$(this).focus();
			
			return false;
		}
	});
}
반응형

'Client Side' 카테고리의 다른 글

Modal Drag  (0) 2023.02.22
Datepicker MinDate  (0) 2023.01.30
async & await  (0) 2023.01.27
FileReader 이미지 미리보기  (0) 2023.01.26
var, const, let  (0) 2023.01.26