Jquery help selecting input fields
<p>I am trying to rewrite this Jquery <a href="http://jsfiddle.net/Claudius/gDChA/4/" rel="nofollow">http://jsfiddle.net/Claudius/gDChA/4/</a> to use this HTML instead <a href="http://pastie.org/2370829" rel="nofollow">http://pastie.org/2370829</a></p>

<p>Jquery:</p>

<pre><code>$('button.add', '#companyinfo').live('click', function(e) {
    $(this).parent().find('button.remove').show();
    $(this).hide();

    var element = $(this).parents('.input').find('input').last().clone().prop('value','');

    var name = element.prop('name');
    var pattern = new RegExp(/\[(.*?)\]/);
    var info = name.match(pattern)[1];
    var newname = name.replace(pattern, '[' + info + 'info' + ']');
    var newid = element.prop('id') + 'info';  

    element.prop('name', newname);
    element.prop('id', newid);    
    element.insertAfter($(this).parents('.input').find('input').last());

})
$('button.remove', '#companyinfo').live('click', function(e) {
    $(this).parent().find('button.add').show();
    $(this).hide();
    $(this).parents('.input').find('input').last().remove('input');
});
</code></pre>

<p>Old HTML </p>

<pre><code>&lt;fieldset id='companyinfo'&gt;&lt;legend&gt;Company info&lt;/legend&gt;

    &lt;div class='input string optional'&gt;
        &lt;label for='company_navn' class='string optional'&gt;Count&lt;/label&gt;
        &lt;input type='text' size='50' name='company[count]' id='company_navn' maxlength="255"  class='string optional' /&gt;
        &lt;div class='button-row'&gt;
            &lt;button class='add'&gt;Add info&lt;/button&gt;
            &lt;button class='remove'&gt;Remove&lt;/button&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="input string optional"&gt;
        &lt;label for="company_navn" class="string optional"&gt;Navn&lt;/label&gt;
        &lt;input type="text" size="50" name="company[navn]" maxlength="255" id="company_navn" class="string optional"&gt;
        &lt;div class='button-row'&gt;
            &lt;button class='add'&gt;Add info&lt;/button&gt;
            &lt;button class='remove'&gt;Remove&lt;/button&gt;
        &lt;/div&gt;
    &lt;/div&gt;    
&lt;/fieldset&gt;
</code></pre>

<p>New HTML:</p>

<pre><code>&lt;div class="input string optional"&gt;&lt;label for="virksomhed_navn" class="string optional"&gt; Navn&lt;/label&gt;&lt;input type="text" size="50" name="virksomhed[navn]" maxlength="255" id="virksomhed_navn" class="string optional"&gt;&lt;/div&gt;
&lt;div class="button-row" style="font-size: 11px; width: 110px; float: right; margin-top: -10px; margin-right: 16px;"&gt;
      &lt;button class="add" style="font-size: 11px;"&gt;Add info&lt;/button&gt;
      &lt;button class="remove" style="font-size: 11px;"&gt;Remove&lt;/button&gt;
    &lt;/div&gt;

    &lt;div class="input string optional"&gt;&lt;label for="virksomhed_name" class="string optional"&gt;Name&lt;/label&gt;&lt;input type="text" size="50" name="virksomhed[name]" maxlength="255" id="virksomhed_name" class="string optional"&gt;&lt;/div&gt;
&lt;div class="button-row" style="font-size: 11px; width: 110px; float: right; margin-top: -10px; margin-right: 16px;"&gt;
      &lt;button class="add" style="font-size: 11px;"&gt;Add info&lt;/button&gt;
      &lt;button class="remove" style="font-size: 11px;"&gt;Remove&lt;/button&gt;
    &lt;/div&gt;


    &lt;div class="input string optional"&gt;&lt;label for="virksomhed_pis" class="string optional"&gt;Pis&lt;/label&gt;&lt;input type="text" size="50" name="virksomhed[v]" maxlength="255" id="virksomhed_pis" class="string optional"&gt;&lt;/div&gt;
&lt;div class="button-row" style="font-size: 11px; width: 110px; float: right; margin-top: -10px; margin-right: 16px;"&gt;
      &lt;button class="add" style="font-size: 11px;"&gt;Add info&lt;/button&gt;
      &lt;button class="remove" style="font-size: 11px;"&gt;Remove&lt;/button&gt;
    &lt;/div&gt;
</code></pre>

<p>How can I select the inputs fields in the new HTML and create the same functionality ? </p>
