0
我一直試圖讓我的eventLabel值等於我的Gravity Form標籤。目前我的代碼是從我的表單的輸入字段拉'name'屬性。不過,我期望在span元素之前拉動標籤文本。從窗體字段返回標籤文本
<li id="field_38_1" class="gfield gfield_contains_required field_sublabel_below field_description_below">
<label class="gfield_label" for="input_38_1">
"Name"
<span class="gfield_required">*</span>
</label>
<div class="ginput_container">
<input name="input_1" id="input_38_1" type="text" value="" class="medium" tabindex="1002">
</div>
</li>
我試過這個,它沒有奏效。它只返回[object Object]。思考?
dataLayer.push({'eventCategory': 'Form - ' +
$(this).closest('form').attr('action'),
'eventAction': 'completed',
'eventLabel': $(this).parents('li').find('label'),
'event': 'gaEvent'});
這個工作!我以爲我曾經在某個時候嘗試過這種方式,但是沒有。謝謝! – Alex