Replace part of form element attribute in jQuery
<p>I want to replace a part of the name attribute with a new value. This value is dependent on the original value. The name attribute has a value of: timeslots[timeslot_1][start]</p>

<ol>
<li><p>How do I increment the value 'timeslot_1' to 'timeslot_2' and replace the original value with this one?</p></li>
<li><p>The cloneElm consists of two types of elements (input and select) - I want to be able to capture both elements in my loop.</p></li>
</ol>

<p>The code I have so far:</p>

<pre><code>$(cloneElm).children('span').children('input').each(function(id) {
        var newName = $(this).attr('name').replace('timeslot_1', 'timeslot_2');
        $(this).attr('name', newName);
    });  
</code></pre>

<p>Thanks</p>
