title: Javascript build dynamic string
body: <p>I need to build a dynamic string as for each data. This string will set up an HTML button, when event click will call a function. I'm having problems with the 'e'. See the example below:</p>
  
  <pre><code>var stringButton = ""; 
  var txtBtn = "My Button";
  for(item in data){
       stringButton= "&lt;input id='btn-" + item.id + "' type='button' href='#'
  class='fbbutton'" + "value=' " + txtBtn + "' onclick='actionBtn(" + item .id + ", '" + 
  item .name + "')'&gt;";
  }
  
  function actionBtn(id, name) {
  //process data.
  }
  </code></pre>
  
  <p>In inspect element I see:</p>
  
  <pre><code>&lt;input id="btn-1599" type="button" href="#" class="fbbutton" value=" My Button " 
  onclick="actionBtn(1599, " itemName"" jjjj')'=""&gt; 
  </code></pre>
  
  <p>The problem is to create string which call methods passing parameters strings.
  As we can see, " and ' are wrong. What is the correct way?</p>