• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 JavaScript, TS 게시판 공백검사 숙제와 else if 문법 에서

공백검사 숙제와 else if 문법 에서

4 글 보임 - 1 에서 4 까지 (총 4 중에서)
  • 글쓴이
  • #67129

    주태헌
    참가자
    선생님
    똑같이 한거 가튼데 alert('아이디입력안함) 박스가 안나오네요.
    어디가 잘못되어 있나요.
    
    
    index.html
    
    
    <!DOCTYPE html>
    <html lang="en">
      <head>
    	<!-- Required meta tags -->
    	<meta charset="utf-8">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
    	<!-- Bootstrap CSS -->
    	<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    	<link href="main.css" rel="stylesheet">
    	<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
    	<title>Hello, world!</title>
    </head>
    <body>
    	<div class="black-bg">
    		<div class="white-bg">
    			<h4>로그인하세요</h4>
    			<form action="success.html">
    				<div class="my-3">
    					<input type="text" class="form-control" id="email">
    				</div>
    				<div class="my-3">
    					<input type="password" class="form-control">
    				</div>
    				<button type="submit" class="btn btn-primary">전송</button>
    				<button type="button" class="btn btn-danger" id="close">닫기</button>
    			</form>
    		</div>
    	</div>
    	<div class="main-bg">
    		<h4>Shirts on Sale</h4>
    		<button id="login" class="btn btn-danger">로그인</button>
    	</div>
    	<script>
    		$('#form').on('submit', function() {
    			if (document.getElementById('email').value == '') {
    				alert('아이디입력안함');
    			}
    		});
    		// UI에 애니메이션 추가하려면
    		$('#login').on('click', function() {
    			$('.black-bg').addClass('show-modal');
    		});
    		//  닫을때 ok, removeClass 사용하면 여러번 됨
    		$('#close').on('click', function() {
    			$('.black-bg').removeClass('show-modal');
    		});
    	</script>
    	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
    </body></html>
    
    
    main.css
    
    
    .alert-box {
        background-color: skyblue;
        padding: 20px;
        color: white;
        border-radius: 5px;
    /*    display: block;*/
    		display: none;
    }
    .list-group {
    	display: none;
    }
    .show {
    	display: block;
    }
    /*숙제*/
    .black-bg {
    	width: 100%;
    	height: 100%;
    	position: fixed;
    	background: rgba(0,0,0,0.5);
    	z-index: 5;
    	padding: 30px;
    /*	display: none;*/
    	visibility: hidden;
    	opacity: 0;
    	transition: all 1s;	
    }
    .white-bg {
    	background: white;
    	border-radius: 5px;
    	padding: 30px;
    }
    .btn-danger {
    	display: none;
    }
    .show-modal {
    /*	display: block;*/
    	
    	visibility: visible;
    	opacity: 1;
    }
    .btn {
    	display: block;
    }
    .none {
    	display: none;
    }
    .main-bg {
    	padding: 100px 20px;
    	background-color: lightgrey;
    }
    
    
    success.html
    
    전송완료~~~
    
    
    
    
    
    
    
    
    #67130

    주태헌
    참가자
    브라켓 에디터 하단에 빨간글씨로 에러 183 뜨네요.
    이리 저리 해보면 에러 번호는 다른번호인데 암튼 에러가 표시되구요.
    
    프로그램을 실행할때마다 
    에러 번호가 186, 188, 190 이런식으로 증가하네요
    
    
    #67158

    codingapple
    키 마스터
    셀렉터로 #form인거 찾고있는데 그런요소가 없어서그런듯요
    하단에러는 무시해도 됩니다
    #67237

    주태헌
    참가자
    오타 찾았습니다.
    해결됐습니다.
    안보이네요
    
    
4 글 보임 - 1 에서 4 까지 (총 4 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관, 개인정보처리방침
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠