0
当前目标值在没有选择器的流星事件中未定义。流星单击事件值未定义
HTML:
<template name="parent">
{{> Child class="col-30" value="picture"}}
{{> Child class="col-70" value="video"}}
</template>
<template name="Child">
<div class="{{class}}">
<input type="hidden" name="type" value="{{value}}" />
</div>
</template>
JS:
Template.Child.events({
'click': function (event, template) {
console.log(event.Target.type.value); //Uncaught TypeError: Cannot read property 'value' of undefined
}
});
谢谢。是的,我需要传递一些参数给参数不应该显示的事件,所以我在隐藏的领域。但有什么办法可以在纯JavaScript中做到这一点? –
流星在核心中使用jQuery,但如果你需要,你可以做console.log(e.currentTarget.value)它也应该工作。 – juliancwirko
在你提到的'my-div-or-input-class-name-here'选择器的代码中。但在我的情况下,我的选择器是动态的。 –