Let us suppose I have this markup
First
Hi
Hello
Second
Keeping in mind Rocket's answer I prefer to use .index()
approach like following:
$.fn.isAfter = function(sel){
return $(this).index() > $(sel).index();
};
$.fn.isBefore= function(sel){
return $(this).index() < $(sel).index();
};
It seems more clear for reading/understanding and works perfectly in rows selection.