javascript - 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 on twitter",              nameuser:"image",              openexternallinks:"newwindow",           });       });</script></head> 

between body

<body> <div id="tweetcontainer"></div> </body> 

i want empty check tweet container if no tweets hide div tweetcontainer

you can this

if($("#tweetcontainer").eq(0).html() == '') {   //this implies there no tweets. whatever need   $("#tweetcontainer").hide(); } 

hope helps!

if need on regular basis perhaps do

function checktweets()     {         if($("#tweetcontainer").eq(0).html() == '')         {           //this implies there no tweets. whatever need            $("#tweetcontainer").hide();         }         else            $("#tweetcontainer").show();       }     //fire once , settime out     checktweets();     settimeout(checktweets,100); 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -