[Vuejs]-Cant set ID value for a <span> tag inside a <th v-for="" >tag

1👍

you can try :id="heading.field"

3👍

id of your span is not binding dynamically, you have to use v-bind: or : to that’s id to use it in way what you want:

Look at example:

<table class="APPPPTable" style="width:100%;font-size:11px;">
    <thead>
      <tr>
        <th v-for="heading in tableInfo.columns" class="text-center">
            <span :id="heading.field" v-html="heading.label"></span>
        </th>
      </tr>
     </thead>
 </table>
👤cccn

1👍

<span id="heading.field"> -> <span v-bind:id="heading.field">

 <table class="APPPPTable" style="width:100%;font-size:11px;">
    <thead>
      <tr>
        <th v-for="heading in tableInfo.columns" class="text-center">
            <span v-bind:id="heading.field" v-html="heading.label"></span>
        </th>
      </tr>
     </thead>
 </table>

Leave a comment