2 글 보임 - 1 에서 2 까지 (총 2 중에서)
-
글쓴이글
-
2023년 6월 30일 17:18 #88965
신미화참가자모달창이 아닌 페이지에서는 button의 submit이 잘 동작하는데 모달창에서 같은 코드를 그대로 복사해도 modal창에서는 아무런 동작도 하지 않네요 (정상코드) -------------------------------------------------- [edit.ejs] 내용 생략...
<div class="form-row"> <div class="form-group col-md-9"> <label>상세내용</label> <textarea class="form-control" rows="4" name="detail" ><%= data.detail %></textarea> </div> </div>
<div class="d-flex flex-row-reverse bd-highlight" > <div class="form-group col-md-5" > a href="/detail/<%= data._id %>" class="btn btn-outline-secondary ml-2" >CANCEL /a <button type="submit" class="btn btn-outline-primary ml-2 col-md-2" >OK</button> </div> </div> </form> </div> (정상코드) -------------------------------------------------- (문제 코드) -------------------------------------------------- [edit.ejs]
<div class="d-flex flex-row-reverse bd-highlight" > <div class="form-group col-md-5" > a href="/detail/<%= data._id %>" class="btn btn-outline-secondary ml-2" >CANCEL /a <button type="button" class="btn btn-outline-primary ml-2 col-md-2" id="open-modal" >OK</button> </div> </div> </form> </div>
<!-- Modal --> <div id="modal"> <div class="modal-content"> <h2><%= data.rackpc %> 수정하기</h2> <p>내용을 수정하시겠습니까?</p> <div class="form-group" > <button type="submit" class="btn btn-outline-primary ml-2 col-md-2" >OK</button> <button id="close-modal" class="btn btn-outline-info">CANCLE</button> </div> </div> </div>
<script> const modal = document.getElementById("modal"); const openModalBtn = document.getElementById("open-modal"); const closeModalBtn = document.getElementById("close-modal"); // 모달창 열기 openModalBtn.addEventListener("click", () => { modal.style.display = "block"; document.body.style.overflow = "hidden"; }); // 모달창 닫기 closeModalBtn.addEventListener("click", () => { modal.style.display = "none"; document.body.style.overflow = "auto"; }); </script>
(문제 코드) -------------------------------------------------- 똑같이 복붙했는데 왜왜왜 모달창에서는 안되는거예용 ㅠ.ㅠ 선생님~~ 고수님들 알려주세요~~ ㅠ,ㅠ
-
글쓴이글
2 글 보임 - 1 에서 2 까지 (총 2 중에서)
- 답변은 로그인 후 가능합니다.