문제

Lets say I have the following code:

template

<a on-click='myfunc' href="#">Activate!</button>

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?
});

How can I prevent the next click event from the a href, from the javascript code? I tried event.preventDefault(); but the object has no method 'preventDefault'

도움이 되었습니까?

해결책

From the docs:

event.original.preventDefault()

Proxy events are, as you've noticed, custom Ractive events; however, the .original property gets you access to the "real" event.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top