Answer the question
In order to leave comments, you need to log in
How to update textbox value in meteor (as you type)?
Good evening. I have a collection Item
. It contains the document { name: 'Abc' }
. There is a template:
<template name='a'><div contenteditable>{{name}}</div></template>
Template.a.helpers({
name() {
return Items.findOne(...).name;
}
});
Template.a.events({
'input div': function(e, tmpl) {
var item = $(e.currentTarget);
clearTimeout(item.data('timeout'));
var id = setTimeout(() => {
var text = item.text();
Items.update(this._id, { $set: { name: text } });
item.val(text);
}, 500);
item.data('timeout', id);
}
});
Answer the question
In order to leave comments, you need to log in
This is a Blaze bug. I don't know how things are now. Perhaps they have already decided.
Then I overcame it like this: removed contenteditable :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question