-1

I am using javascript that built by w3school call w3.js it's very interesting to use w3-iclude to include html and w3-repeat to list predefined data. But I wonder is there any way to use w3-include with w3-repeat together?

I have tried with w3-include => it's OK tried with w3-repeat => it's OK trying combine w3-include and w3-repeat

TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

0

I got the answer for myself :)

<div id="id01">
 <a w3-repeat="customers" href="{{LinkURL}}">
  <img src="{{MyImage}}" style="width:42px;height:42px;">
</a> 
</div>


<script>
w3.getHttpObject("js/customers.js", myFunction);

function myFunction(myObject) {
  w3.displayObject("id01", myObject);
}
</script>

in this case,I got customers.js file from w3school. declare the id01 in div element,then call w3-repeate in "a href". purpose: list all images that I define in customers.js and use them as link.