Development/HTML&CSS
HTML. Return Confirm Call function if yes; return confirm() 실행 후, call function
오도원공육사
2020. 8. 13. 16:13
반응형
확인 문구창을 띄운 뒤, 확인을 누르면 함수를 실행하는 구문이다.
<button onclick="confirm('Are you sure ?') && call_function()">Button</button>
예시.
<button onclick="confirm('Are you sure ?') && saveAndSubmit(event)">Button</button>
function saveAndSubmit(event){
alert('saveAndSubmit called !');
}
참고.
https://stackoverflow.com/questions/32394684/how-to-confirm-and-call-function-with-onclick
https://stackoverflow.com/questions/43672682/return-confirm-call-function-if-yes/43672768
반응형