开发者

On Document Ready, Trigger a function that is binded by a click

I have a function in a JavaScript like so:

$("#table-filters li").click(function(){ **开发者_运维百科* Lots of stuff here...
});

What I would like to happen is when the page loads, to one-time, run that function. Something contained in:

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

Suggestions?

Thanks!


$(function(){ 
  $("#table-filters li")
    .click(function(){
      // Lots of stuff here...
    })
    .slice(0,1).click();
});


Use this:

$("#table-filters li").trigger("click");


$("#table-filters li:first").trigger("click");

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜