title: Reference Error: variable is not defined
body: <p>I got a variable called "nthchild" <code>var nthchild = ($(ui.selected).index() + 1);</code>
  This gives me the nth-child of a list item with the class selected. I even log it in the console and it works fine. However when I try to use this variable but it doesn't work.</p>
  
  <pre><code>$("section:nth-child(" + nthchild + ")").style.marginTop = "200px";
  </code></pre>
  
  <p>So it should give the section a margin-top of 200px. But the console is giving me the error</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: nthchild is not defined</p>
  </blockquote>
  
  <p>You can find my code on this <a href="http://codepen.io/tobiasglaus/pen/xgBeaJ" rel="nofollow noreferrer">codepen</a></p>
  
  <pre><code>$(function() {
      $("#selectable").selectable();
  });
  
  $(function() {
      $("#selectable").selectable({
          selected: function(event, ui) {
              var nthchild = ($(ui.selected).index() + 1);
              console.log(nthchild);
          }
      });
  });
  
  $("section:nth-child(" + nthchild + ")").style.marginTop = "200px";
  </code></pre>