我们需要获取所选下拉菜单的属性名称以进行分析。现在,如果我们点击其中一个。它只会显示“主题”。 “国家”属性名称没有得到。自定义选择 - 获取所选下拉菜单的属性名称
<label>Subject</label>
<br />
<select name="subject" class="custom-select">
<option value="">enquiry?</option>
<option value="1">General enquiry</option>
<option value="others">Others</option>
</select>
<label>Country</label>
<br />
<select name="Country" class="custom-select">
<option value="Australia" selected="selected">Australia</option>
<option value="2">New Zealand</option>
</select>
JS:
$('.custom-select').each(function() {
var select = $(this).selectize({
onChange: function(value) {
Forms.onChangeSelectValue(value, select);
},
onBlur: function(){
Analytics.pushData({
eventCat: 'Form',
eventAct: document.title,
eventLab: $('select.custom-select').attr('name')
});
}
});
});
“eventLab” 被触发仅 “受试者”。不是“国家”
不确定是否使用jQuery代码调用通用元素是错误的。
@Tushar - 错过了,而复制/粘贴 – TDG