Hello and thanks for your help.
I have a php script on my website that returns my last few tweets in form of an unordered list with the posts each being a list item.
<div id="latesttweet">
<ul>
<li>
This is a tweet<br />
<span>3 hours ago.</span>
</li>
<li>
This is another tweet<br />
<span>4 hours ago.</span>
</li>
</ul>
</div>
I tried to hide some of them dynamically using JavaScript, but for some reason once I collect all the list items in an Array, I can't address them properly anymore. When I alert the length of the Array however, I get the right number. jQuery seems to be working alright in general.
var activeTweet = 0;
var tweet_ul = document.getElementById('latesttweet');
var tweetArray = tweet_ul.getElementsByTagName('li');
var tweetCount = tweetArray.length;
alert(tweetCount); //returns the right result
tweetArray[1].hide();
This way, one should expect that the second list item would have display
set to none
, but still both items remain visible.
What am I doing wrong?