1
配列を値で埋めるために、この2つの関数があります。私は2の代わりに1つの配列だけを埋めたいと思います。どのようにして連想配列を作ることができますか?2つの配列を1つの連想配列に変更します。
var itemMetaArray = [];
var itemLabelArray = [];
$('.frm_pro_form input, .frm_pro_form select, .frm_pro_form textarea').each(function(){
if ($(this).attr('type') != 'hidden' && ($(this).attr("type") != "submit")) {
itemMetaArray.push($(this).attr("name"));
}
});
$('.frm_form_field label').each(function(){
itemLabelArray.push($(this).text());
});
console.log(itemMetaArray);
console.log(itemLabelArray);
<div id="frm_field_71_container" class="frm_form_field form-field frm_top_container">
<label for="field_p0hth" class="frm_primary_label">
Date
<span class="frm_required"></span>
</label>
<input type="text" id="field_p0hth" name="item_meta[71]" value="" maxlength="10" class="frm_date" />
</div>
:これを試してみてください。第二に、あなたのHTMLはどのように見えますか? 'label'は' input'にどのように関係していますか? –
ここにHTMLがあります: