페이지 내에 Jquery 가 정상적으로 load 되었는지 체크 하는 방법입니다.
// 1. if (window.jQuery) { // jQuery is loaded } else { // jQuery is not loaded } // 2. if (typeof jQuery == 'undefined') { // jQuery is not loaded } else { // jQuery is loaded } // .. 만약 Load 되어있지 않다면.. 추가하기 if (!window.jQuery) { var jq = document.createElement('script'); jq.type = 'text/javascript'; jq.src = 'http://code.jquery.com/jquery-latest.min.js'; document.getElementsByTagName('head')[0].appendChild(jq); }
참고 Url : http://jquery-howto.blogspot.kr/2009/03/check-if-jqueryjs-is-loaded.html