Manny Posted September 25, 2016 Share Posted September 25, 2016 (edited) Hi there, I'm trying to implement an instance of DataTables onto a new site and came across the following link: https://jsfiddle.net/6k0bshb6/20/ I have edited the JS section to this: $(document).ready(function () { var dataTable = $(".datatables").DataTable({ "autoWidth": false, "bLengthChange": false, "bFilter": false, "bInfo": false, "bSort": false, "pageLength": 10 }); // Alternative Pagination $("#button").on( 'click', function () { var VisibleRows = $('.datatables>tbody>tr:visible').length; var i = VisibleRows + 5; dataTable.page.len( i ).draw(); } ); }); The script does everything I need, with one exception. There are 14 rows in total. Once all 14 rows have been loaded, I want the 'button' to disappear so the user can no longer click it. How can I achieve this? Edited September 25, 2016 by Manny Link to comment Share on other sites More sharing options...
dsonesuk Posted September 26, 2016 Share Posted September 26, 2016 Maybe var TotalRows = $('.datatables>tbody>tr').length; if(TotalRows>=14) { $("#button").hide(); } else { $("#button").show(); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now