title: How to dynamically set a data-target id?
body: <p>I have three div's with different IDs. I would like to concatenate <code>myModal + i</code> into the <code>data-target</code> attribute, but I am unsure of how to do it. Here is my code:</p>
  
  <pre><code>success: function (response) {
      var work;
      var res = response.split("§");
      var modalid;
      for (var i = 0; i &lt; res.length - 1; i++) {
          modalid = "myModal" + i;
          work = res[i].split("^");
          document.getElementById('eventi').innerHTML += "Cena del: " + work[0] + "&lt;button type=\"button\"  data-toggle=\"modal\" data-target=\"#\"\"&gt;leggi di piu&lt;/button&gt;" + "&lt;br&gt;";
          document.getElementById('description' + (i)).innerHTML = work[1];
      }
  }
  </code></pre>