I've got an object that declares other objects and then I'm looping through a series of inputs. Each of those inputs have a parent div that wraps them in sections so "credit, cash and debt".
var paymentObj = {
credit: {},
cash: {},
debt: {}
};
$('.payments input').each(function(){
var paymentCategory = $('input[class*="filter-section-"]').attr('class').match(/filter-section-(.*)/)[1];
var paymentName = this.id;
}
If I do a console.log(paymentObj). I get values like:
Object { credit={visa=true, mastercard=false, amex=true}}, cash={}, debt={mastercard=true, amex=false}}
How would I get the values of just the credit object? I'm really looking to return if something is set to true in the credit object as comma delimited. visa, amex
I learn best by code samples so please include code samples. Any help is greatly appreciated!