Hi guys.
Here I find interesting article about module pattern on JS https://css-tricks.com/how-do-you-structure-javascript-the-module-pattern-edition/
and started to write simple app – for creating TODO lists. But, from the start found problem(I think it something simple, but I can’t get);
Here is my pen http://codepen.io/Kuzyo/pen/paoKi
Can somebody explaine to me, why my getTask function doesn’t work in this way:
getTask: function() {
var self = this;
s.textField.on("keydown", function(e) {
if(e.keyCode == 13) {
s.task = $(this).val();
self.setTask();
}
})},
But work in this :
getTask: function() {
var self = this;
$("input").on("keydon", function(e) {
if(e.keyCode == 13) {
s.task = $(this).val();
self.setTask();
}
})},
Thanks for the help!
Sooooooorrrrrryyyy, I did stupid mistake, misspelling in a variable.