1
私が扱っている情報の連想配列を作成します。私はこのようなインデックスで個別に各入力のプロパティが含まれていますコントロールの配列を作りたいオブジェクトがjQueryのオブジェクト内に置かれているときにオブジェクトの子にアクセスする方法
var controls = {};
$('#userForm').find('div.control').each(function(index, Element)
{
if($(Element).find('input').attr('type') == "checkbox")
{
var attributes = {}; // Object
attributes["type"] = "checkbox";
attributes["name"] = $(Element).find('.controlText').text().toLowerCase().split(" ").join("_")+"_"+$(Element).find('input').attr("id");
attributes["required"] = $(Element).find('input').hasClass('required');
controls[index] = attributes;
$(controls[index]).children().each(function(){
// How do i check the controls object each value
alert($(this));
});
}
});
;:私は、次のコードを持っています
controls [0] => [type] = checkbox [name] = chk_box_1 [required] = true [1] => [type] = checkbox [name] = chk_box_2 [required] = false
...同様に同様。
どのように私は、コントロールの配列を作成し、javascriptの要素を参照して、PHPに渡し、そこに配列を印刷できますか?