I use KnockoutJS to iterate over an object, for example:
Now it all works. But the problem is that it sets the id for button only a number. So it looks like this:
<button id="1">Button 1</button> <button id="3">Button 2</button> <button id="8">Button 3</button>
So, I tried to set the prefix before the Id property, for example:
<div data-bind="foreach:Items"> <button data-bind="text: Name, attr: {'id': 'myprefix_' + Id}"></button> </div>
But this does not seem to work. My id populated with some observable Knockout function when I do it like this ...
So my question is: how can I add a prefix when I specify the id attribute of a field?
w00 Sep 20 2018-12-12T00: 00Z
source share