-2

for some reason my code does not show the button on the screen, can someone help me? I leave the code below. This is a image enter image description here

This is a code

<table id="myTable"class="table table-striped table-bordered table-hover table-condensed myTable">
<tr>
  <td class="bg-primary"><b>Email</b></td>
  <td class="bg-primary"><b>Fecha</b></td>
  <td class="bg-primary"><b>Nombres</b></td>
  <td class="bg-primary"><b>Distrito</b></td>
  <td class="bg-primary"><b>Teléfono</b></td>
  <td class="bg-primary"><b>Residuos</b></td>
  <td class="bg-primary"><b>Cantidad</b></td>
  <td class="bg-primary"><b>Unidad</b></td>
  <td class="bg-primary"><b>Descripcion</b></td>
  <td class="bg-primary"><b>Archivo</b></td>
</tr>
  <? for (var i = 0; i < data.length; i++) { 
    if(data[i][0].toUpperCase() !== email.toUpperCase()) {?>
    <tr style="display:none;">
      <? for (var j = 0; j < data[i].length; j++) { ?>
        <td><?= data[i][j] ?></td>
      <? } ?>
    </tr>
  <? } else{ ?>
    <tr>
      <? for (var j = 0; j < data[i].length; j++) { ?>
        <td><?= (data[i][j]= /www |http/.test(data[i][j]) ? '<a class="btn btn-primary text-white btn-xs" target="_blank" href='+data[i][j] + '><i class="far fa-arrow-alt-circle-down"></i>Img</a>': data[i][j]) ?></td>
        
      <? } ?>
    </tr>
  <?} }?>
</table>
  • Please include what templating framework you're using. – code Oct 27 '22 at 23:32
  • 1
    Your framework expects `= ... ?>` to output text, not HTML. Check the documentation to find out how you can indicate that the value is HTML that should be rendered. – Barmar Oct 27 '22 at 23:38
  • This is developed in app script, it is a section of the html – Bladimir HC Oct 27 '22 at 23:46
  • Related question: [How can I echo HTML in PHP?](https://stackoverflow.com/questions/1100354/how-can-i-echo-html-in-php) – Yogi Oct 28 '22 at 00:01

1 Answers1

-1

Unsure of the framework you are using (along with html and javascript), but it looks like the following could work:

<td>
  <? if( data[i][j]= /www |http/.test(data[i][j] ) { ?>
    <a class="btn btn-primary text-white btn-xs" target="_blank" href="<? = data[i][j] ?>"><i class="fa fa-arrow-alt-circle-down"></i>Img</a>
  <? } else {
    data[i][j])
  } ?>
</td>
willbeing
  • 393
  • 2
  • 14