开发者

empty check for this script?

between head

<head><script type="text/javascript">$(document).ready(function() {
        $.twitter.start({
            searchType:"searchWord", 
            searchObject:"google", 
            lang:"en", 
            live:"live-180", 
            placeHolder:"tweetContainer", 
            loadMSG: "Loading messages...", 
            imgName: "loader.gif", 
            total: 6, 
            readMore: "Read it on Twitter", 
            nameUser:"image", 
            openExternalLinks:"newWindow", 

        });


    });</script></head>

between body

<body>
<div id="tweetContainer"></开发者_JS百科div>
</body>

I want to do an empty check for tweet container as if no tweets then hide Div tweetContainer


You can do this

if($("#tweetContainer").eq(0).html() == '')
{
  //this implies there are no tweets. so do whatever you need to
  $("#tweetContainer").hide();
}

Hope this helps!

If you need to do this on a regular basis then you could perhaps do

function checkTweets()
    {
        if($("#tweetContainer").eq(0).html() == '')
        {
          //this implies there are no tweets. so do whatever you need to
           $("#tweetContainer").hide();
        }
        else
           $("#tweetContainer").show();


    }
    //fire once and then setTime out
    checkTweets();
    setTimeout(checkTweets,100);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜