Search code examples
javascriptjquerypaginationdatatablesdisabled-control

How to make pagination "Next" button not look disabled in Datatables


I'm using Datatables pagination to show my records. My problem is that when I go to the end of my table using the "next" button of the table, this button becomes disable. I want this button not to look Disable. I have tried this :

$j('#buttonID').attr("disabled", "disabled");
$j('#buttonID').disable(true);
$j('#buttonID').prop('disabled', false);

but this are not working. Can anybody help me with an example?


Solution

  • To remove the disabling effect you have to remove the attribute disabled at all since disabled="true" or disabled="false" are considered as disabled, you could use removeAttr():

    $j('#buttonID').removeAttr('disabled');
    

    Hope this helps.

    $('#buttonID').removeAttr('disabled');
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    
    <button disabled="true">Button 1</button>
    <button disabled="false">Button 2</button>
    <button disabled>Button 3</button>
    
    <button id="buttonID" disabled>Button 4</button>