0

私が呼び出す関数があります:

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).
//...
}

次に、反復したいセレクターがあります。

$(control_group).each(createNode);

これからIDSのリストを作成する方法はありますか?

var arr = [];
arr.push($(control_group).each(createNode));

コントロール内にコントロールを作成する再帰的なコントロール ビルダーを実行しているため、子属性に識別子を返したいと考えています。それが私がarrでやろうとしていたことです。

私の1つのアイデアは、次のような簡単なことをすることでした:

var arr = [];
$(control_group).each(function(e){
    arr.push(createNode(e,$(this));
});
4

1 に答える 1