7
Hello I’m having a problem with the use of this code. I want inside the div with class output to show the following html code, this code is inside a for so I used the append, here is giving syntax error, you could help me?
$('.output').append('<li class="canal row"><div class="col"><img style="width: 80px; height: 80px;" class="rounded-circle" src="'+data2.logo+'"></div> <div class="col-6"><p class="tituloCanal"><a href="'+data2.url+'" class="linkTitulo">'+data2.display_name+'</a> </p><p class="desc">'+data2.status+'</p> </div>'+
if(data.stream===null){+'<div class="online col"> <a href="#" class="onlineIcon">on</a> </div>'+} else{'+<div class="online col"> <a href="#" class="onlineIcon">on</a> </div>'+}+'</li>');
You’re trying to concatenate a
if
in string?– Woss
Dude, take that off if from within the append. Put that your string within a variable, manipulates it outside and finally adds the variable in the append.
– Douglas Garrido
That’s right! @Andersoncarloswoss
– Diemano Nóbrega