title: how to get (this) element's parent index and pass it as a value?
body: <p>In the following example,how would i get the parent <code>&lt;ol&gt;</code> index inside the wrapper div and pass it as a value in the li's innerText ?
  tried something like $(this).closest(&quot;ol&quot;).index() but did'nt work</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("li").text("this ol's index is " + $(this).closest("ol").index());</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;div&gt;
  &lt;ol&gt;&lt;li class="li"&gt;&lt;/li&gt;&lt;/ol&gt;
  &lt;ol&gt;&lt;li class="li"&gt;&lt;/li&gt;&lt;/ol&gt;
  &lt;ol&gt;&lt;li class="li"&gt;&lt;/li&gt;&lt;/ol&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>