jQuery 공부하는 중에 이런 코드가 나오는데
$('<img/>').load(function() {
$('#loading').hide();
if ($('#wrapper').find('img').length)
return;
current = $this.index();
var $theImage = $(this);
$('#wrapper').append($theImage);
(...중략)
이게 img 엘리먼트를 만들고 난 다음에 여러가지 작업을 하고 wrapper에 append 하는건 알겠거든요.
근데 jQuery API 문서를 보니까 load가 Ajax쪽, 이벤트쪽 이렇게 두 가지 경우가 있는데 이 경우는 이벤트쪽 load더라구요.
근데 이게 Deprecated 됐는데.. 그럼 load 말고 어떤 방향으로 코드를 짜야 하나요;;?
.on('load', function() {}
걍 on으로 바인딩시키면 되는겁네까?
ㅇㅇ 이래서 제이쿼리보다 자바스크립트를 먼저 공부하란거임 onload 이벤트잖앙
자바스크립트 겅부할 때 보면 onload를 항상 document로 한정시켜서 알려줘가지고 ㅠ 감사해욧