I’m using Feedburner to show feeds. Sometimes the feeds have the same text. I would like to ‘hide’ any ‘duplicates’ of a certain feed. I have wrapped the feedburner script inside a div ‘unique’ like this: jsFiddle
I have set display:none for the feeds because I only want to show the feeds which match the ‘index’. I don’t understand why the var is not ‘showing’
I think the
.text()query is incorrect.The above returns just text:
There is nothign in
ato iterate through.I think you may be wanting to do:
This returns a list of items you can iterate over now.
The next issue I can see is that your filter method simply iterates through the array of 12 items and still return the same 12 items, the item at the index will always match the current item.
Try this solution:
See DEMO
I declared
uniqueas an object. This object will keep a record of each anchor text value we already processed by adding theitemtextas a property assigning the oftrue. This is possible due to the dynamic nature of JavaScript which allows you to assign proeprties to an object on the fly.When calling
unique[itemText]we are asking theuniqueobject to give us value of the property with the name matching what is initemText.If the property exists the value
trueis returned as that is the value we assign to the property. We will now remove the value from the source as we already processed it.If the property is not found then
undefinedis returned and we add the property dynamically to theuniqueobject assigning it the value oftrue.With the source now stripped of the duplicates we make the container visible again.