몸체가로드되면 JS를 약간 실행하고 싶습니다. 내 프레임 워크는 정적 인 두 개의 다른 파일에서 머리글/바닥 글을로드하고 본문은 동적입니다. 따라서 온라인으로 읽으면 $ (elem) .load (function())을 본문 끝 부분에 배치 할 수 있으며 페이지를로드하면 함수가 실행됩니까? 나는 이것을 간략하게했지만 작동하지 않는 것 같습니다.몸체가로드 된 후 jQuery가 실행됩니다.
{%include file='/var/www/include/tpl/header.tpl'%}
<div id="contentMain">
<h1>{%$heading%}</h1>
{%if isset($Details)%}
<h4>Details</h4>
{%$Details%}
{%/if%}
{%$table%}
</div>
<div id="space">
</div>
<script>
$("#contentMain").load(function(){
alert("It worked!");
//run some stuff here
});
</script>
{%include file='/var/www/include/tpl/footer.tpl'%}
이 기능을 사용하는 방법에 대한 도움은 매우 감사하겠습니다.
document.ready? 문서가로드 된 후로드됩니까? – Sakthivel
은'