Advertisement
Virajsinh

Load More JQuery

Jun 30th, 2021
1,468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.51 KB | None | 0 0
  1. //https://stackoverflow.com/questions/8352372/how-to-add-load-more-button-for-a-html-css-page
  2.  
  3. $(function(){
  4.     $("div").slice(0, 10).show(); // select the first ten
  5.     $("#load").click(function(e){ // click event for load more
  6.         e.preventDefault();
  7.         $("div:hidden").slice(0, 10).show(); // select next 10 hidden divs and show them
  8.         if($("div:hidden").length == 0){ // check if any hidden divs still exist
  9.             alert("No more divs"); // alert if there are none left
  10.         }
  11.     });
  12. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement