I have this code:
db.transaction (function (tx) {
tx.executeSql('SELECT * FROM cartoes WHERE usuario = ${0}', [], function(tx, results){
for(var i=0; i<results.rows.length; i++) {
var nomeEmpresa = results.rows.item(i).empresa;
var nome = results.rows.item(i).nome;
var id = results.rows.item(i).id;
var d = new Date();
var capa = results.rows.item(i).img2 + '?time=' + d.getTime();
$(".listagem-cartoes").append(
'<div style="width: 100%; overflow-x: hidden;">
<div class="cartoes">
<div class="item-total">
<div class="col s12 m8 offset-m2 l6 offset-l3" style="width: 50%;">
<div class="card-panel grey lighten-5 z-depth-1">
<div class="row valign-wrapper foto" id = ${id}>
<div class="col s3 lista-cartoneira editar-cartao" style="padding-left: 0px;">
<img src="${results.rows.item(i).img2 + '?time=' + d.getTime()}" alt="" class="circle responsive-img foto" id=${id}>
</div>
<div class="col s9 lista-cartoneira">
<h1>${nomeEmpresa}</h1>
<h2>${nome}</h2>
</div>
</div>
</div>
</div>
</div>
<div class="col s12 m8 offset-m2 l6 offset-l3" style="width: 50%; float: right; margin-top: -136px;">
<div class="card-panel grey lighten-5 z-depth-1">
<div class="row valign-wrapper botoes">
<div class="atalhos-cartoneira col s3" style="background-color: #00b0ff;">
<i class="material-icons telefone" id=${id}>phone</i>
</div>
<div class="atalhos-cartoneira col s3" style="background-color: #ffb74d;">
<i class="material-icons email" id=${id}>email</i>
</div>
<div class="atalhos-cartoneira col s3 botao-localizacao" id=${id} style="background-color: #757575;">
<i class="material-icons localizacao" id=${id}>place</i>
</div>
<div class="atalhos-cartoneira col s3" style="background-color: #00BFA5;">
<i class="material-icons compartilhar" id=${id}>open_in_new</i>
</div>
</div>
</div>
</div>
</div>
</div>'
);
}
});
});
This code is intended to list all the user's cards.
(thesecondonestayedthatwaybecauseithasnoimage).
WhatIwanttodoisthefollowing..
Ihaveinmybank,too,theaddresstable.Nocardisrequiredtohaveanaddress.Ifitdoesnot,Iwanttoremovethelocationbutton(address)ONLYonthecardthathasnoaddress,soitwouldlooklikethis:
Todothis,Imakeanappointmentinthebankandcheckwhichcardshavenoaddress:
db.transaction(function(tx){tx.executeSql('SELECT*FROMenderecosWHEREcartao=${id}',[],function(tx,results){for(vari=0;i<results.rows.length;i++){varendereço=results.rows.item(i).endereco;if(endereco==""){
//AQUI É ONDE MORA O PROBLEMA. EU QUERO ESCONDER/REMOVER O BOTÃO SOMENTE NO CARTÃO QUE NÃO TEM ENDEREÇO. COMO PODERIA FAZER ISSO?
}
}
});
});
In the last code is where the problem lives ... I want to hide the button only on the card that has no address. How could I do that?
This is the div that has been inserted through the append that I need to hide / remove:
<div class="atalhos-cartoneira col s3 botao-localizacao" id=${id} style="background-color: #757575;">
<i class="material-icons localizacao" id=${id}>place</i>