How to update var self = this?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
7 views
var function = function() { var self = this; $('#input').on('change', function() { var itemName = self.itemName; console.log(self.itemName); // old value }) }


As with every change in input to take actual self, because outside of the function this.ItemName changes.
by | 7 views

1 Answer

0 like 0 dislike
Why this hellish design?
here:
$('#input').on('change', function() { var inp_val = $(this).val(); console.log(inp_val); })
by
110,608 questions
257,186 answers
0 comments
35,647 users