Problem when binding an event

Problem when binding an event

nlamnlam Posts: 2Questions: 0Answers: 0
edited May 2010 in General
Hi,

We created a dataTable and want to bind a function to the hover event of the elements. We have a function such as:

[code]

$("tr").hover(
function (e) {
alert("hover");
});

[/code]

This works great when we first get into the page. But as soon as we click to a different page in the dataTable, the bind seems to break. The alert never pops up when we hover over a row. It doesn't work again until we refresh the entire page.

Has anyone encountered this problem? Should I be binding to the hover event a different way?

Thanx in advance.

Replies

  • nlamnlam Posts: 2Questions: 0Answers: 0
    Ok, I didn't read the FAQ carefully enough the first time. I re-read it, and with some experimentation, I got it to work.

    Apologies.

    Here is the solution for those of you that search here before you read the FAQ like I did:

    First read the FAQ at the very bottom right hand corner for the question: Q: My events aren't being applied. Then do code similar to this:

    [code]
    "fnDrawCallback": function() {
    $("tr").hover(function() {
    alert("hover");
    });
    }
    [/code]

    And, voila!
This discussion has been closed.