oshirowanen
oshirowanen

Reputation: 15925

jQuery live help

I have the following script which works perfectly until I regenerate the links ".resultLink" via jquery ajax:

$("a.resultLink").live('click', function()
{
    var that = this;

    $.ajax({
        url: 'most_used.aspx',
        type: 'POST',
        data: { strMostUsedID:$(that).attr("href") },
        error: function() { },
        success: function() { }
    });
});

"live" normally fixes this for me but this time it did not. Not sure what I am doing wrong.

Upvotes: 0

Views: 182

Answers (1)

Nick Craver
Nick Craver

Reputation: 630549

The most likely cause I can think of is the selector not matching, double check that the .resultLink class is being applied to the new links...if it's not the .live() handler won't match the selector.

Upvotes: 2

Related Questions