I am using zrss script to display a rss feed. The rss feed is for my forum and each entry has "Go
to last post" at the end of each post. I want to remove this.
//var str = $('#div').text()
//str.replace('Go to last post', '');
//$('#div').text(str);
$('#div').text($('#div').text().replace('Go to last post', ''));
RDO
Member
309 Points
282 Posts
replace text with javascript
Dec 29, 2012 08:27 PM|LINK
I am using zrss script to display a rss feed. The rss feed is for my forum and each entry has "Go to last post" at the end of each post. I want to remove this.
Code to load rss feed
$('#div').rssfeed('http://www.rssfeedurl', { limit: 10 }); });Code to load rss feed then replace text
$('#div').rssfeed('http://www.rssfeedurl', { limit: 10 }); var str = $('#div').text() str.replace('Go to last post', ''); $('#div').text(str); });It loads the rss feed fine, but does not replace "Go to last post" with ""
Any ideas?
Christian Forum
bit010
Member
185 Points
34 Posts
Re: replace text with javascript
Dec 29, 2012 09:22 PM|LINK
Try this:
//var str = $('#div').text() //str.replace('Go to last post', ''); //$('#div').text(str); $('#div').text($('#div').text().replace('Go to last post', ''));Andreas
RDO
Member
309 Points
282 Posts
Re: replace text with javascript
Dec 29, 2012 09:28 PM|LINK
$('#div').rssfeed('http://www.feedurl', { limit: 6, date: false, linkcontent: true, media:true, header: false }); $('#div').text($('#div').text().replace('Go to last post', ''));still shows "Go to last post"
Christian Forum
bit010
Member
185 Points
34 Posts
Re: replace text with javascript
Dec 29, 2012 10:36 PM|LINK
I think you need to put the replacement code in $(window).load (so it runs after the RSS content has been loaded):
<script type="text/javascript"> $(document).ready(function () { $('#div').rssfeed('http://www.feedurl', { limit: 6, date: false, linkcontent: true, media: true, header: false }); $(window).load(function () { $('#div').html($('#div').html().replace('Go to last post', '')); }); }); </script>Andreas
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: replace text with javascript
Dec 30, 2012 02:24 PM|LINK
Hi,
Your code needs to be reafctored like this -
$('#div').rssfeed('http://www.rssfeedurl', { limit: 10 }); var str = $('#div').text() str = str.replace('Go to last post', ''); $('#div').text(str); });Hope it helps u...
Roopesh Reddy C
Roopesh's Space