Quantcast
Channel: reformating an RSS feed with jQuery - Stack Overflow
Viewing all articles
Browse latest Browse all 3

reformating an RSS feed with jQuery

0
0

I am currently pulling an RSS feed in which the the format is essentially title->image->text content. I would like to reformat it so that the image comes first. I am currently trying:

<script type="text/javascript">
    $(document).ready(function() {
$("li.rssitem").each(function() {
$(".rssdescription a img").remove().insertBefore("h3");
    });
    });
</script>

HTML looks like:

<ul id="rssitems">

<li class="rssitem"><h3 class="rsstitle"></h3>
<div class="rssdescription"><p><a href="#"><img src="..."></a></p><p>content</p></div></li>

<li class="rssitem"><h3 class="rsstitle">><a href="#">...</a></h3>
<div class="rssdescription"><p><a href="#"><img src="..."></a></p><p>content</p></div></li>

</ul>

Which works except that there are many items (all with images) in the list. This code puts ALL the images before all the h3's. I am clearly having trouble looping correctly. Thanks so much guys!


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images