팝업창에서 바로 submit 하면
팝업창 자체에서 target = "_self" 로 인식되어 submit 되어버림
팝업창에서 부모창으로 submit 하려면
target = "부모창" 으로 지정해줘야 함
JS
function fnSubmit() {
const form = document.popForm;
window.opener.name = "parentPage"; //부모창 이름 임의 설정
form.target = "parentPage"; //타겟 = 부모창
form.action = "/sample/parent.do"; //부모창으로 이동
form.submit();
self.close(); //팝업창 닫기
}
HTML
<form name="popForm" method="post">
<input type="hidden" value="keyVal" name="keyName"/>
</form>
<input type="button" onclick="fnSubmit()" value="submitBtn"/>
'Frontend' 카테고리의 다른 글
[jQuery] $(document).ready()와 $() (0) | 2022.04.07 |
---|---|
[JS/jQuery] 버튼 활성화/비활성화 (+ fieldset) (0) | 2022.03.28 |
[JS/jQuery] document.getElementById vs jQuery$() (0) | 2022.02.17 |
[CSS] 테이블(table, td) 여백 제거 (0) | 2022.02.10 |
[JS] 문자열 ➡ 배열로 변환(split) (0) | 2022.02.09 |
댓글