Can’t hide element when empty

<div id="url" class="infoline">
  <i class="fa fa-link fa-2x fa-fw coloriconfa"></i>
  <a href="<?=$data['post']['url']?>" target="_blank"><?=$data['post']['url']?></a>                     
</div>

Hide searches with this function JS

$(document).ready(function() {
$("#url").each(function() {

    if($.trim($(this).html()).length == '') {
       $(this).hide();
    };
 });
});

Help me please