jquery rename all attributes
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/317170/how-can-i-change-html-attribute-names-with-jquery">How can I change HTML attribute names with jQuery?</a>  </p>
</blockquote>



<p>I have a large/complex form with different available questions based on the previously selected questions. </p>

<p>To try and keep this a little organised I have a few duplicate inputs with the same name. This creates the problem where input further down the page even if they are hidden are overwriting the visible inputs.  </p>

<p>To prevent this I have set all hidden inputs with <code>data-name</code> instead of <code>name</code> attribute.</p>

<p><strong>Questions</strong>
How can I change the attribute name. E.g:</p>

<pre><code>&lt;input data-name="phone" value="" /&gt;
&lt;input data-name="email" value="" /&gt;

To
&lt;input name="phone" value="" /&gt;
&lt;input name="email" value="" /&gt;
</code></pre>
