(function(){
$('input[type="button"]').on('click', function(){
var $this = $(this),
$td_arr = $this.parent().html('complete').prevAll('td');
$.each($td_arr, function(){
var $td = $(this);
$td.html('<input type="text" value="'+$td.html()+'">');
});
});
})();
</script>