Problem when binding an event
Problem when binding an event
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.
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.
This discussion has been closed.
Replies
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!