jquery를 사용하고 코드를 작성하는 방법에 대해 정말로 좌절합니다. 나는 몇 달 전에 JS와 jQuery를 코딩 시작하고 내 코드는 다음과 같이 보았다 : 전에js로 코딩 할 때 올바른 함수 시퀀스
.ready $ (문서) 안에 모든 것을 넣어 않았다 기본적으로 무엇을
$(document).ready(function(){
$(function(){// a function that applies a plugin to an element});
$(function(){// another function that applies a plugin to an element});
$(function(){// and another function that applies a plugin to an element});
$(function(){// yet another function that applies a plugin to an element});
});
$(function(){//functions applied to certain elements that does not require to be initially loaded})
을 여기에 내가 얼마나입니다 코딩은 지금
function a(){//a function that applies plugin to an element}
function b() {// another function}
$(document.ready(function(){a(); b();});
$(function(){//functions applied to certain elements that does not require to be initially loaded})
조금 개선되었지만 만족스럽지 않습니다. 특정 페이지에 대해서만 특정 기능을 호출하고 싶다면 어떻게해야합니까? 이것을 성취 할 수있는 방법이 있습니까? 그리고 많은 플러그인을 사용하고있을 때 내 $ (문서)가 실제로 얼마나 거대 해지는지 정말 싫어합니다.
jquery에서 함수를 작성하는 방법에 대해 알려주십시오.