JQuery Index Query

JQuery Index Query

Hi,

Just assume I have the following code (not exactly but similar one),

<ul>

<li><a onclick="SomeFunction()">First</a></li>

<li><a onclick="SomeFunction()>Second</a></li>

<li><a onclick="SomeFunction()>Third</a></li>

</ul>

_____________________

Whenever, a onclick event occur I need to a additional li there. for eg, if a onclick event occur in the 'First'

then the code should be changed using AJAX like below,

<ul>

<li><a onclick="SomeFunction()">First</a>

          <ul><li><a onclick="SomeFunction()">sub of First 1</a></li></ul>

</li>

<li><a onclick="SomeFunction()>Second</a></li>

<li><a onclick="SomeFunction()>Third</a></li>

</ul>

________________________________


If I have a function like below,

$(this).find("ul li a").click( function(){ } )

Is there a way to identify the index of "ul li a" .

for eg, ul li a:first will return the 'First" object and "ul li a:eq(1)" return the sub of First 1 object.

Is there any way to identify the index whether that is first/last/index position from the onclick event.

Thanks in Advance