Thx Matthew,
the  e.target in  <<.indexOf(e.target)>> is new for me.

I think the main different in jq is that it is looking for parents
automaticly

here the jq code:
        index: function( elem ) {
                if ( !elem || typeof elem === "string" ) {
                        return jQuery.inArray( this[0],
                                // If it receives a string, the selector is used
                                // If it receives nothing, the siblings are used
                                elem ? jQuery( elem ) : 
this.parent().children() );
                }
                // Locate the position of the desired element
                return jQuery.inArray(
                        // If it receives a jQuery object, the first element is 
used
                        elem.jquery ? elem[0] : elem, this );
        },


my code in mo is:
        elem = document.getElement(".headline nav a.selected"),
        items = $$(".headline nav a"),
        num = items.indexOf(elem) + 2;

the code in jq is:
                        elem = $(".headline nav a.selected"),
                        num = elem.index() + 2,

Reply via email to