jQuery - function runs fine when fired on div click, but not on page load

后端 未结 5 923
[愿得一人]
[愿得一人] 2021-01-25 17:49

I have the following function that I want to run on page load and re-run when you click div#trigger. When you click div#trigger everything is fine. However on page load the code

5条回答
  •  长情又很酷
    2021-01-25 18:13

    Your function need to be called in document.ready call

    $(document).ready(function() {
       textIndentFunc();
    });
    

提交回复
热议问题