javascript - Show/Hide content with Jquery, MVC -


i'm using mvc show on page comments on given post. code:

@foreach (var comment in post.comments) {     <div>         <img src="@url.action("getimage", "post", new { userid = comment.userid })" height="50" width="50"/>         @html.displayfor(c => comment.user.firstname)         @html.displayfor(c => comment.user.lastname):         @html.displayfor(c => comment.text)         @html.displayfor(c => comment.datecomment)     </div>     <hr /> } 

so gives comments given post. how can show latest 3 post, , rest can loaded "more" button using jquery?

order comments latest ones first, on each show more

// if have comments class on each comment div $('div.comments').not(':visible')[0].show(); $('div.comments').not(':visible')[1].show(); $('div.comments').not(':visible')[2].show(); 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -