title: How to set an id to elements created on the fly in KnockOutJS
body: <p>How to set an id to elements created on the fly in KnockOutJS. As you see I have two spans, one for the button, second one for the small icon on the corner of button(see image below). And all this for total of 6 elements. Now I dont know how to manage with css, cuz they have no unique ID.
  <br> What to do?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[![enter image description here][1]][1]
  
  &lt;script id="normal" type="text/html"&gt;
      &lt;div class="ItemIndicateur"&gt;
          &lt;span class="BuIndicateur" data-bind="text: $parent.CatFullName() == true ? CatNom : CatNomOnglet, click: $parent.ClickedItem, attr: { id : IdCat}" style="display:block; color: white; padding:10px" /&gt;
          &lt;span class="NbDemandeDiv" data-bind="text: NbDemandeIndicateur,visible: IsNbDemandeIndicateur, attr: { id : $parent.IdNbDemande()}"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="ListeIndicateur" data-bind="template: {name: GetItemTemplate, foreach: ListeIndicateur},"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/NUxF1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NUxF1.jpg" alt="enter image description here"></a></p>