Tell me how to limit the number of entries in the html table using js
UPDATE2
Here is the code with the table, how to screw? Do so
<head> <style> table tbody tr:nth-child(n+6) { display:none; } table.viewall tbody tr:nth-child(n+6) { display:table-row; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script> </head> <body th:fragment="payments-scheduled(firstBunches, secondBunches, failedBunches, firstFriday, secondFriday)"> <fieldset> <div class="form-group"> <div class="table-container"> <h3 class="header bolder smaller" th:text="#{bunch.failed}></h3> <div class="row"> <div class="col-lg-11"> <div class="ibox float-e-margins"> <div class="ibox-content"> <table class="footable table table-stripped toggle-arrow-tiny"> <thead> <tr> <th width="10" th:text="#{provider.code}">Имя</th> <th width="200" th:text="#{provider.legalName}">Имя</th> <th width="200" th:text="#{providerBalance.balance}">Состояние</th> <th width="100" th:text="#{providerPaymentBunch.paymentDueDate}">Код</th> </tr> </thead> <tbody> <tr th:each="entity,iterStat : ${balances}" th:object="${entity}"> <td th:text="*{provider.code}"></td> <td th:text="*{provider.legalName}"></td> <td><a th:text="*{balance}" th:href="@{${rootPath}+'/balance/'+ *{id}}"></a></td> <td th:text="*{#ldates.format(providerPaymentBunch?.date)}"></td> </tr> </tbody> </table> <button class="btn-viewall">показать все</button> </div> </div> </div> </div> .... <script> $('.btn-viewall').on('click',function(){ $('table').toggleClass('viewall'); }); </script> </body> Mistake
actual: 697 Uncaught ReferenceError: $ is not defined at actual: 697
line
$ ('. btn-viewall'). on ('click', function () {$ ('table'). toggleClass ('viewall');});