Condition not working

Condition not working

Hello

I am trying to make a condition that triggers alert when there is img with trans.gif in #left div  and #right div has no img with trans.gif. But it is not working. What am I doing wrong?


    $(document).ready(function() {
            if ($("#left img[src^=trans.gif]").size() > 0
                && $("#right img").attr("src") != "trans.gif")                                      
                                                            
         
              {
                  alert ("helloworld");
                
                  };
    });