For example I have one text box
with readonly
style, and then I attach the value to it by click other button.
Should I use event handler
for attach value checking?
Such as blur, change...
You could use the button click event handler.
Template.myTemplate.events({
'click #myCoolBtn': function() {
$('#myCoolTxtBox').val('my_cool_new_value');
}
});
Excuse me, I want to use event on it too
'change #myText': function() {
alert('My text is attached value');
}
Seems like onchange would be the best bet. What results are you getting
from your experiments?
lets imagine that you have
<template name='myTemplate'>
<input type='text' name='myinput'/>
<button name='mybutton'> Attach value and handler </button>
</template>
Template.myTemplate.events({
'click [name=mybutton]': function(evt, tmpl) {
var inputEl = tmpl.find('input[name=myinput]');
if !inputEl return;
inputEl.value = 'this is tje value for input';
inputEl.dataset.watch = 'watch';
},
'input input[data-watch]': function(evt, tmpl) {
var inputValueIs = evt.target.value;
}
});
Look great I will try.
Thanks a lot.