Q:

jquery not working on using pagination

Am just trying to show all the list in the pagination. am using datatable plugin's pagination on my file, pagination is working fine, in the list i have an image that have a function delete on click. in my pagination 1'st five records is shown . and the other five records shown on click next, delete function working properly on 1'st five record when i click on next than delete function stop it's working .
my code:- 
<script>
var conf = jQuery.noConflict();
conf(document).ready(function(){
 conf(".delete").on( "click", function() {
alert('adfasdfasd');
    //alert(conf(this).attr("id"));
custid  = conf(this).attr("id");

var r=confirm("Are you sure");
if (r==true)
  {

        var url = "<?php echo Mage::getBaseUrl();?>turnkey/index/deleteuser/";
            conf.ajax({
            type:"POST",
            url:url,
            data: { 'custid':custid},
            success: function(msz){
            alert(msz);
            if(msz=="deleted") {
            conf("#hidepro"+custid).hide("slow"); 
            }
            else {
                //conf("#hidepro"+proid).hide();
            alert("product cant be deleted");
            }
            //console.log("chal hun");
            }
        });
  }
else
  {
 return false ;
  }

  });
});

</script>

and the pagination code is :-
    <script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
                $('#example').dataTable();
            } );
    </script>

<div id="container">

<div id="demo">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
    <thead>
        <tr>
            <th>Factory</th>
                <th></th>
            <th>Contact</th>
            <th>URL</th>
            <th>Remove</th>

        </tr>
    </thead>
    <tbody>

<?php 
foreach( $custemail as $custemail1 ) { 
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($custemail1); //load customer by email id ?>

        <tr class="odd gradeX" style="  border-bottom: 1px solid #FF0000;" id = "hidepro<?php echo $customer['entity_id'] ?>">
            <td class="bodyText style4" ><a style=" color: #CC3300;float: left;margin-top: 42px !important;text-decoration: underline;" href="<?php echo Mage::getBaseUrl();?>turnkey/index/listuser?id=<?php echo $customer->getEntity_id();?>"><?php echo $customer->getFactory();?></a>   </td>

        <td class="bodyText style4">
<a href="<?php echo Mage::getBaseUrl();?>turnkey/index/listuser?id=<?php echo $customer->getEntity_id();?>">
<img style=" width:100px;height:100px;margin-bottom:5px ;" src = "http://lab.ghrix.com/turn-key-mart/media/<?php echo $customer->getUserImage();?>"></a>

</td>
            <td class="bodyText style4" style="padding-top: 10px;">
<?php echo $customer->getFirstname();?><?php //echo $customer->getUser_address();?><br><?php echo $customer->getmobile();?><br><?php echo $customer->getEmail();?></td>

            <td class="bodyText style4" style="float: left;margin-top: 42px !important;" >

<a target="_blank" style="color:#005580;" href="<?php echo $customer->getWebsite();?>"><?php echo $customer->getWebsite();?></a></td>

            <td class="bodyText style4"><div  style= "cursor:pointer;" class = "delete" id  = "<?php echo $customer['entity_id'] ?>"><img width="60px" src="<?php echo $this->getSkinUrl('images/trash.jpg'); ?>"</div></td>

        </tr>

<?php }?>   

    </tbody>
</table>
            </div>      

        </div>

please suggest where mistake is happen.

A:

Without a live example, I can't be sure, but try this:
replace
conf(".delete").on("click", function() ...

with:
conf(document).on("click", ".delete", function() ...

The reason is that conf(".delete") only attaches to elements available at the time the function is run. It might be that your dataTable plugin runs first, removes the extra elements, then the delete binder is run and only works on the first 5. The second method binds to the document, and checks each click to see if it matches the .delete selector. This used to be known as jQuery.live()

