Meteor events and input type=range

Does anybody know how to add an event handler to a HTML5 range input type?

<template name="range">
 <input type="range" value="10">
</template>

Template.range.events({
 'change input[type="range"]': function(e,t) {
  console.log(e.target);
 }
});

does not work …

The correct event would be input but it has problems with IE, so you might also try jQuery’s mousemove or combine the two.

Doesn’t work. What I didn’t mention is that I am using ionic, which uses fastclick.js, which might be the reason … haven’t tried input type=range without it yet

Just created a blank project without fastclick or anything and change event fires.

Ergo: not Meteor issue but related to some other Javascript library …

And one more update:

Template.range.events({
 'change input[type="range"]': function(e,t) {
  console.log(e.target);
 }
});

the above works absolutely fine, but one has to attach the event listener to the correct template. :frowning:

I am using Iron Router with #contentFor xyz and attached the event to the template containing the #contentFor instead of template xyz

Let that be a lesson, kids: stay away from drugs

2 Likes