title: jquery - syntax for including a jquery object as a text or html property
body: <p>I am not sure what is the correct way of writing the code, or is it even a possible jquery format.</p>
  
  <p>I have </p>
  
  <pre><code>for(i=0; i&lt;10; i++) {
    var inner = $('&lt;div/&gt;', {text: 'it works'});
    var x = ' xyz ';
  
    var row = $('&lt;div/&gt;', {
      id: 'foo',
      'class': 'abc',
      html: 'test'+ x + inner.text(),
      css: {'padding-left': '5px'}
    });
  
    row.appendTo('body');
  }
  </code></pre>
  
  <p>The output is test xyz [object Object]</p>
  
  <p>What is the correct syntax for displaying the inner variable so that the correct output would be 'test xyz it works' ?</p>
  
  <p>I know that it would work with using <code>inner.appendTo(row)</code> </p>
  
  <p>A secondary question: If I could get the code to work, what would be faster?  appendTo or defining the html with a variable.</p>
  
  <p>TIA </p>