javascript - Ractive.js preventDefault events on event proxies - Stack Overflow

Lets say I have the following code:template<a on-click='myfunc' href="#">Acti

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'

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'

Share Improve this question asked Sep 25, 2013 at 21:35 LuisLuis 776 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 11

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744166214a4561315.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信