How can I get the "indexOf" an element in a <p>? (jquery)
<p>I just want to get the index position of tagged elements(marks) inside a paragraph.
ex:</p>

<pre><code>&lt;p&gt;
   Lorem ipsum dolor ipsum sit &lt;mark&gt;amet&lt;/mark&gt;
   consectetur adipisicing elit, sed &lt;mark&gt;amet&lt;/mark&gt; 
&lt;/p&gt;
</code></pre>

<p>I'm trying to emulate the "<strong>ctrl+f</strong>" function in a div. So im using a plugin called <strong>textselect</strong> to select/highlight 
my search result with this:</p>

<pre><code>var startPosition = textHolder.indexOf(textToSelect);
var endPosition = startPosition + textToSelect.length;

$.textSelect('setRange', {
                        start: startPosition,
                        startElement: $("p"),
                        end : endPosition,
                        endElement : $("p")
                    });
</code></pre>

<p>but i don't know how can i get the <strong>startposition</strong>...</p>

<p>I tried this:</p>

<pre><code>var textHolder = $('div').find('p').contents("mark").eq(0);

$('div').find('p').html().indexOf(textHolder.html())
</code></pre>

<p>and returns 34 this would be the startposition of the first mark but if  change the textholder to <code>.eq(1)</code> returns 34 again. How can I get the <strong>indexOf</strong> of each mark substring?</p>