강의

멘토링

커뮤니티

Inflearn Community Q&A

mingdi's profile image
mingdi

asked

JavaScript+jQuery from Basics to Practice: Basics Part.2

Practical Exercise - Events using jQuery (2)

load( ) 기능에서 코드 수정해서 사용

Written on

·

220

0

검색해보니 jQuery 1.8 버전 이후로 load( ) 기능이 제거되어

강의에 나와있는 코드로는 실행이 불가능하고

 

$(window).on('load', function( ){ ... });
$(function() {
            $(document).ready(function() {
                let h1 = $(".img").height();
                console.log("ready() : " + h1);
            });

            $(window).on('load', function() {
                let h2 = $(".img").height();
                console.log("load() : " + h2);
            });
        });

 

이렇게 작성하면 jQuery 버전을 바꾸지 않고도 정상적으로 실행이 가능한데요!
강사님이 알려주신 제이쿼리 버전을 낮춰서 사용하는 방법으로 실무에 사용해도 웹사이트 호환성이나 구현에 문제가 없는건지 궁금합니다.
 
jqueryjavascript

Answer

This question is waiting for answers
Be the first to answer!
mingdi's profile image
mingdi

asked

Ask a question