Arrange the numbers in input name element array from zero up after remove a input
<p>I want after remove one of the rows (Ex: <strong>Row 2</strong>) in html code changed to in name element by jQuery.</p>

<p>For example we first have in html as:</p>

<blockquote>
  <p><strong>Row 1:</strong>  name="check[<strong>0</strong>][]" <br>
  <strong>Row 2(removed):</strong>  name="check[<strong>1</strong>][]" <br>
  <strong>Row 3:</strong>  name="check[<strong>2</strong>][]" <br>
  <strong>Row 4:</strong>  name="check[<strong>3</strong>][]" <br></p>
</blockquote>

<p>Now if we remove the second row, In fact, after removed the row 2,  we have rows like this:</p>

<blockquote>
  <p><strong>Row 1:</strong>  name="check[<strong>0</strong>][]" <br>
  <strong>Row 3:</strong>  name="check[<strong>2</strong>][]" <br>
  <strong>Row 4:</strong>  name="check[<strong>3</strong>][]" <br></p>
</blockquote>

<p>But i want it in result (after remove one of rows ex: row 2) as:</p>

<blockquote>
  <p><strong>Row 1:</strong>  name="check[<strong>0</strong>][]" <br>
  <strong>Row 3:</strong>  name="check[<strong>1</strong>][]" <br>
  <strong>Row 4:</strong>  name="check[<strong>2</strong>][]" <br></p>
</blockquote>

<p>I tried as (see my full code) but Don't work: <a href="http://jsfiddle.net/k3wne/" rel="nofollow">http://jsfiddle.net/k3wne/</a></p>

<p>Js:</p>

<pre><code>$('.remove_input').live('click', function (e) {
    e.preventDefault();
    var remove = $(this).closest($class);
    remove.fadeOut('slow', function () {
        $('.add_units').each(function (idx, val) {
            var num = $('.add_units').length;
            NumIdx = (num - (num - idx));
            //for(var i = 0; i &lt; num-1; i++){
            $(this).closest($class_guide).next($class_guide).each(function (idx, val) {
                $('.add_units input[type="checkbox"]').attr('name', function (idx, str) {
                    var int = parseInt(str.match(/\d+/)[0], 10);
                    return str.replace(int, NumIdx);
                })
            });
            //}
        })
    });)
}​
</code></pre>
