get element index with siblings

$.getElemIdx = function(_el) { var $el = $(_el); var _result = ($el.length) ? $el.index() : 0; if ($el.parent('li').length) { _result = $el.parent('li').index(); } return _result; };

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.