I'd like to pull an attribute value from the input
This is some of my html:
<input type="checkbox" name="invoice" client="14" value="53">
<input type="checkbox" name="invoice" client="14" value="54">
<input type="checkbox" name="invoice" client="17" value="52">
But I can't seem to be able to select anything, everytime I try to use a function while I'm eaching through them, is throwing undefined function
var inputs = $('input[name=invoice]');
inputs.each(function(){
console.log(this.attr('client'));
});
Uncaught TypeError: undefined is not a function
while if I say this.value it returns 53, 54 and 52
$(this)instead ofthis. You want to access the jQuery element, not the dom element which have not the .attr methodthis === HTMLElement,.attr() === jQuery method. HTMLElement doesnt have access to the jQuery method. Use$(this).attr('client')this.getAttribute('client')