可以说我有以下代码:
模板
<a on-click='myfunc' href="#">Activate!</button>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
var ractive = new Ractive({
el: output,
template: template
});
ractive.on( 'myfunc', function ( event ) {
alert( 'Hello world!' );
?????? --> how to prevent the next click event from the a href?
});
Run Code Online (Sandbox Code Playgroud)
如何从javascript代码中阻止来自href的下一个单击事件?我试过event.preventDefault(); 但该对象没有'preventDefault'方法