JavaScript - - By Sam Deering

jQuery Get Index of Current Element

jQuery code snippet to get index of the current element. Good for those tasks that you use all the time and can simply put into a function for reuse.

$.fn.getIndex = function(){
	  var $p=$(this).parent().children();
    return $p.index(this);
}
Sponsors
Login or Create Account to Comment
Login Create Account