Set tab index after ajax refresh

Hello all,

if you ever bump into a situation where you need to refresh aprt of a form, you may notice that, somehow, the tabindex of your elements is a little bit messed up. As you can guess, I just bumped into it...

To fix it, just run the folowing, or similar, JavaScript after the refresh:

var $startTabIndex = parseInt($('.MainContent :input').eq(0).attr('tabindex'));
    $('.MainContent :input').each(function(idx,elem){
           $(elem).attr('tabindex',$startTabIndex + idx);

Having this issue.  However, I cannot get this to correct it.