0
나는 내가 함수를 호출 한 :내가 배열로 .each 호출에서 반환 값을 저장 어떻게
$(control_group).each(createNode);
인가 :
CreateNode(e,control);// which will return an ID.
// e i leave alone, but i was thinking that i
// could pass the object into the function this way optionally.
function CreateNode(e, control){
if(!control) control = this;
// for rest of function, calls to the object are $(control) instead of $(this).
//...
}
그때 내가 반복하려는 선택을 거기에이에서 IDS의 목록을 작성하는 방법과 같은 :
var arr = [];
arr.push($(control_group).each(createNode));
내가 컨트롤에 컨트롤을 만드는 recurive 제어 빌더를하고있는 중이 야하고, 그래서 자식 속성으로 식별자를 반환하고 싶습니다. 그것이 내가 arr으로 할 일입니다.
내 하나 개의 아이디어는 같은 간단한 뭔가하고 있던:
var arr = [];
$(control_group).each(function(e){
arr.push(createNode(e,$(this));
});
내 경우 크기 배열, .map()에서 마지막 createNode 실행 배열을 반환하는 것 같습니다. 내가 모르는 뭔가가 있습니까/ – Fallenreaper
'$ (control_group)이란 무엇입니까? 'map()'은 당신이 원하는 매개 변수를 전달하지 않을지도 모른다는 것에주의하라. – SLaks