What I want to do is when I double click on a cell a textbox appears to update the cell data. Then I want to get the value updated. For now I tried this :
$('#previsionnel td').dblclick(function () {
var $this = $(this);
var input = $('<input>', {
value: $this.text(),
type: 'text',
blur: function () {
$this.text(this.value);
},
keyup: function (e) {
if (e.which === 13)
input.blur();
}
}).appendTo($this.empty()).focus();
var test = $this.find("input").val();
console.log(test);
$('#previsionnel td').change(function () {
console.log(test);
});
});
Everything works, except I just can't get the data updated with $(this).text()
In my console log the result is empty.
Some screenshots of what is supposed to do :
As you can see in the last screenshot, the second value in the console must be 5000 and not 100000.00.