Reputation: 1522
Currently the feed xml will return 20 items (child), and each time I only want to display 10 item in single page. The .each function of jQuery will loop whole document right? but I want make it only loop 10 items? Do I need to use the ':eq()'?
Note: I need use this for mobile device environment.
<channel>
<title>Property</title>
<link></link>
<lastbuilddate>Wed, 13 Oct 2010 23:50:51 GMT</lastbuilddate>
<generator>FeedCreator 1.8.0-dev ([email protected])</generator>
<atom:link href="sample.com" rel="self" type="application/rss+xml"></atom:link>
<item>
<title>sample title</title>
<description>
#cdata-section
</description>
<pubdate>Wed, 08 Dec 2010 23:04:25 GMT</pubdate>
</item>
<item>... ... </item>
<item>... ...</item>
<item>... ... repeat 20 times </item>
<channel>
Upvotes: 0
Views: 328
Reputation: 15835
Make a count variable ,
as soon as you reach count=10 break the loop by doing a return false
doing a return
///it should break the loop
jsFiddle example here
Upvotes: 1