Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Promoted
Can anyone with jQuery help me?
Let's say I have
<div class="post"></div>
I want jQuery to calculate how many <div class="post"></div> are in my index file and if there are more than 3, to hide the rest of the .post class div's.
Thank you in advance for your help.
2 Answers
Relevance
- ChrisLv 72 years agoFavorite Answer
const $posts = $('.post');
if ($posts.length > 3) $posts.each(function (i) { if (i > 2) $(this).hide(); });
- Anonymous2 years ago
Good luck figuring it out i guess?
Still have questions? Get your answers by asking now.