Return to Snippet

Revision: 14722
at July 29, 2009 09:29 by dougunderscorenelson

Updated Code
$.fn.getIndex = function(){
	  var $p=$(this).parent().children();
    return $p.index(this);

Revision: 14721
at June 9, 2009 20:56 by dougunderscorenelson

Initial Code
$.fn.getIndex = function(){
  var parentSet=$(this).parent().children();
  return $(parentSet).index(this);

Initial URL

Initial Description
Quickly get the index of the current element. I find myself re-using this several times in a document, so I made a lil' function for it.

Initial Title
Get index of the current element.

Initial Tags
javascript, jquery

Initial Language