I am looking to loop through all inputs on my page and declare a variable for each using the the id as name. This is what i have tried without success
$('input').each(function(){
eval( 'var'+$(this).attr('id')+'='+$(this).val());
});
Try this see if this works :
$('input').each(function(){
window[this.id] = this.value;
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments