开发者

how to invoke an event that just got binded

Probably very stupid question but I can't find a satisfying solution.

I do have a list of anchors each displaying a different rss feed in a designated area on the page (div).

$(".rssfeed").bind('click', function(e) {
     e.preventDefault();
     $('.focus').removeClass('focus');
     $(this).addClass('focus');
     $('#rssarea').rssfeed($(this).attr('href'), {limit:10});
});

Now with jquery how do i invoke the click event on the first link, so that the rssarea gets populated with feeds and the link itself gets it's focus class? I was hoping for something like:

$('#rss1').sendEvent('click');

but sendEvent does not exist, any 开发者_开发知识库other solutions?

regards, Jeroen.


You can trigger it:

$('#rss1').trigger('click');


you can use

  $('#target').click();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜