$(function(){ $("#changePw").click(function(){ if($(this).is(":checked")){ $("#password").attr("disabled", false); $("#passwordCheck").attr("disabled", false); }else{ $("#password").attr("disabled", true); $("#passwordCheck").attr("disabled", true); } }); }); function update() { var changePw = $("#changePw").is(":checked"); var pw1 = $('#password').val(); var pw2 = $('#passwordCheck').val(); var name = $('#name').val(); var company = $('#company').val(); var tell = $('#phonenum').val(); var email_1 = $('#email').val(); if (changePw && pw1 == "") { alert('비밀번호를 입력해주세요'); $('#password').focus(); return; } else if (changePw && pw2 == "") { alert('비밀번호를 입력해주세요'); $('#passwordCheck').focus(); return; } else if (changePw && (pw1 != pw2)) { alert('비밀번호가 일치하지 않습니다.'); $('#pass').focus(); return; } else if (name == "") { alert('이름을 입력해주세요'); $('#name').focus(); return; } else if (company == "") { alert('소속기관을 입력해주세요'); $('#company').focus(); return; } else if (tell == "") { alert('연락처를 입력해주세요'); $('#phone_num').focus(); return; } else if (email_1 == "") { alert('이메일을 입력해주세요'); $('#email').focus(); return; } else { $("#updateForm").submit(); } }