/ Published in: jQuery
                    
                                        
Since forms only read the name of the element and not the id, this could be helpful since it makes each each element's name its id and its id the name.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$(document).ready(function(){
var thename;
var theid;
$('*').each(function() {
if($(this).attr("name"))
{
thename=$(this).attr("name");
$(this).attr("id",thename);
}
});
$('*').each(function() {
if($(this).attr("id"))
{
theid=$(this).attr("id");
$(this).attr("name",theid);
}
});
});
Comments
 Subscribe to comments
                    Subscribe to comments
                
                