我有简单的表单,我正在使用标签和输入文本字段
//In below javascript function i'm trying to read the value of text input as
jQuery(this).find(".fr_field_wrapper .fr_half").each(function(i, obj) {
var addValue = jQuery(this).find("text").val();
if (addValue == undefined || addValue == null || addValue != "") {
addValue = jQuery(this).find("select").val();
}
var labelval = jQuery(this).find("label").text().trim().replace(/(\r\n|\n|\r)/gm, "");
AllElements.push({
id: _elementid,
label: labelval,
value: addValue,
type: 'address'
});
});
//where 'addValue' is undefined for textboxes
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="fr_grid">
<div class="fr_half has_sub_label">
<label class="fr_sub_label">City</label>
<input type="text" data-rv-input="model.value.city">
</div>
<div class="fr_half has_sub_label">
<label class="fr_sub_label">
ZIP Code
</label>
<input type="text" data-rv-input="model.value.zipcode">
</div>
</div>