0
我在複選框上附加了EventListener。複選框旁邊是一個符號(歐元符號)。歐元符號不應該是可點擊的,但是,通過我的代碼,複選框和它旁邊的標籤是可點擊的。你知道嗎,我在這裏做錯了什麼?附加監聽器不應該聽取複選框旁邊的標籤
我創建了下面的HTML片段:
<div class="ui-myProject-radio ui-myProject-fieldset clearfix">
<input type="radio" name="prefrage1_unit" value="1" id="prefrage1_unit_id_1" data-property-name="PRE_FRAGE1_EINHEIT"/>
<label class="prefrage1_bottom_right_in_label" for="prefrage1_unit_id_1">
{{Str.euro_sign}}
</label>
</div>
用下面的JavaScript片段:
var unit = new RadioButton({
selectors: ['#prefrage1_unit_id_0', '#prefrage1_unit_id_1'],
sessionStorageKey: SessionKey.forms.PRE_FRAGE1.PRE_FRAGE1_EINHEIT.key,
initialValue: 0
}).create();
page.fields.unit = unit;
page.fields.unit.on('click', function() {
page.validateForm();
});
感謝很多:)
嘗試更改事件而不是單擊事件 –
這聽起來像元素與我重疊,請使用檢查元素工具檢查它們嗎? – AaronCarson