jquery index() of section
<p>I'm using jquery sortable on div containing a number of section elements. I would like to use index() to output position of each section. </p>

<p>index() only returns value for the first section but it can't locate the second one (or third, fourth etc.)</p>

<p>I can't figure out what am I doing wrong. Any help would be appreciated. Here's my code: </p>

<pre><code>    &lt;div id="existingquestions" class="sortable"&gt;
            &lt;section class="question" id="question_777"&gt;
                &lt;p id="positionof_777"&gt;&lt;/p&gt;
                &lt;p class="questiontext"&gt;question.text&lt;/p&gt;
                &lt;script&gt;$(document).ready(function() {
                            var qpos = Number($('.sortable &gt; section:visible').index('#question_777')+1);
                            $('#positionof_777').html(qpos);
                        });
                &lt;/script&gt;
            &lt;/section&gt;
            &lt;section class="question" id="question_888"&gt;
                &lt;p id="positionof_888"&gt;&lt;/p&gt;
                &lt;p class="questiontext"&gt;question.text&lt;/p&gt;
                &lt;script&gt;$(document).ready(function() {
                        var qpos = Number($('.sortable &gt; section:visible').index('#question_888')+1);
                        $('#positionof_888').html(qpos);
                    });
                &lt;/script&gt;
           &lt;/section&gt; 
    &lt;/div&gt;
</code></pre>

<p>The other function that I'm using works just fine although it's basically the same as above:</p>

<pre><code>    $(document).ready(function() {
        $('input').placeholder();
        $(".sortable &gt; section:visible").hover(function() {
            var index = $(this).index()+1;
            $("#example_index").html("Index " + index);
        });
    });
</code></pre>

<p>I'm clueless. What am I doing wrong in the first example? </p>
