开发者

initiate function using jQuery

开发者 https://www.devze.com 2022-12-18 18:22 出处:网络
I want to call two functions automatically when the page loads. How to do it with jQuery? Suppose my function is getData();

I want to call two functions automatically when the page loads. How to do it with jQuery?

Suppose my function is getData();

How do I开发者_JAVA百科 initiate this via jQuery?


$(function(){
    getData();
});

See Introducing $(document).ready()

$(function() 

is a shorthand for

$(document).ready(function()


JQuery way

$(function(){

getData1();//first function

getData2();//second function

});

$(document).ready(function(){

            getData1();
            getData2();

});

javascript way

0

精彩评论

暂无评论...
验证码 换一张
取 消