Reputation: 1004
I have that Jquery code:
$('input[name*="fotos[]"]').each(function (i, ele) {
alert(ele.val());
});
but I get that error in browers:
Error: TypeError: ele.val is not a function
what is wrong here?
Upvotes: 1
Views: 934
Reputation: 340045
The ele
parameter to the .each
callback is a single DOM element, not a jQuery object.
You should either:
use the native DOM property - ele.value
, or
convert ele
back into a jQuery object - $(ele).val()
NB: within the callback, this === ele
Upvotes: 2