Issue with own JQuery code

Issue with own JQuery code

chusrubi2chusrubi2 Posts: 2Questions: 1Answers: 0

I'm using Datatables for my own stuff but I have a little issue with pagination and my own JQuery code usage.

What's going on?

I have a <td> that is like this:
<a class="playBtn" data-md5="'.$row['md5_file'].'" data-name="'.$row["filename"].'" data-id="'.$row["ID"].'" data-fileformat="'.$row["fileformat"].'" title="Play"><img src="modules/Music/images/play.png" width="15" height="15"></a>

So I have a JQuery function like this:
$("a.playBtn").click(function(){....

The thing is, it works perfectly on the first page of the pagination but not on the rest.

Any solution?

This question has an accepted answers - jump to answer

Answers

  • musinikmusinik Posts: 22Questions: 5Answers: 1
    edited January 2016 Answer ✓

    Is this

    $("a.playBtn").click(function(){....
    

    in fnDrawCallback function ?

    If you use server-side you have to bound events to newly created objects, which are rendered by DataTables. The fnDrawCallback should help doing that.

  • chusrubi2chusrubi2 Posts: 2Questions: 1Answers: 0

    Merci, solved.

    But quite a mess that I have to paste like 3-4 long functions in the same file :[

This discussion has been closed.