0
나는 window 객체를 사용하여 객체 내의 속성 이름을 동적으로 만들 수 있다는 것을 here이라고 읽습니다. 내가동적 객체 이름을 만드는 데 window 객체 (또는 더 나은 방법)를 사용하는 방법
function storeValues(){
var info = {};
$('.class1').each(function(index1, value1){
$('.class2', $(this)).each(function(index2, value2){
//so here I'd like to add a string to the property name
//like 'param-' and 'detail-' so I could end up with a
//structure like
//info.param_0.detail_0
//then
//info.param_0.detail_1
//info.param_1.detail_0
//info.param_1.detail_1
//info.param_1.detail_2
info.'param_'index1.'detail_'index2 = $(this).find('.desired_input').val();
});
}
같은 기능을 가지고이
을 수행하는 방법은 무엇입니까는이 가능하다. 아니면 그것을하는 더 똑똑한 방법이 있습니까?
적어도이 방법은 잘못된 것입니다. info [ 'param _'+ index1] [ 'detail _'+ index2] – devnull69