开发者

jquery event handler calls the function twice

开发者 https://www.devze.com 2023-03-15 05:15 出处:网络
When the a-tag with the class \"like\" is clicked the event handler calls the function twice. I tried all hints of an event bubbling post, but they didn\'t work or were not me case.开发者_开发技巧

When the a-tag with the class "like" is clicked the event handler calls the function twice. I tried all hints of an event bubbling post, but they didn't work or were not me case.开发者_开发技巧

$('.like').live('click', function(){
    $.get($(this).attr('rel'), function(data)
    {
      $('.like').html(data);
    });
    return false;
 });

Maybe you have some more possible solutions for me?


did you try this?:

$('.like').die().live('click', function(){


Looks like everything works as supposed (take a look at the console):

http://jsfiddle.net/KU82w/1/

Can you provide the piece of HTML that your link is in?

0

精彩评论

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