开发者

how to invoke an event that just got binded

开发者 https://www.devze.com 2023-03-11 16:04 出处:网络
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).

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

精彩评论

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