I have a simple for loop:
for (var i = 0; i < 10; i++) {
$('#input' + i).on('blur', function() {
var values = $('#input' + i).val();
console.log(values);
});
}
I want to get the values of my #input, if I write something in my input I just get the message undefined in my console.
But Why if I run the following I get something correct ?
for (var i = 0; i < 10; i++) {
$('#input' + i).on('blur', function() {
var values = $('#input0').val();
console.log(values);
});
}
How do I put that values onto another id in that loop?