Research/Javascript
jquery_ready() 메소드로 페이지 로딩 즉시 함수 실행시키기
RIEM
2022. 11. 21. 21:06
728x90
페이지 로딩 즉시 함수를 시키려면 ready() 메소드를 사용하면 된다.
ready() 메소드는 js의 문법은 아니고 jquery의 메소드다.
> index.html
<script>
// Automatically executed when the page is loaded
$(document).ready(function(){
listing();
})
function listing() {
console.log('Loaded successfully!')
}
</script>
브라우저에서 페이지를 로딩 시 바로 실행하는 함수를 만들고 싶다면 위와 같이 하면 된다.
728x90