$(document).on('click', 'a.edit-row', function (e) {
e.preventDefault();
var _self = $(this);
var row = $(this).closest('tr');
row.find('.on-editing').removeAttr('hidden');
row.find('.on-default').attr('hidden', true);
row.children('td').each(function (i) {
var _this = $(this);
var content = $(this).text();
if (!_this.hasClass('actions')) {
_this.html('<input type="text" class="form-control text-center" value="' + content + '"/>');
}
});
}).on('click', 'a.save-row', function (e) {
var _self = $(this);
var row = $(this).closest('tr');
row.find('.on-default').removeAttr('hidden');
row.find('.on-editing').attr('hidden', true);
row.children('td').each(function (i) {
var _this = $(this);
if (!_this.hasClass('actions')) {
_this.html(_this.find('input').val());
}
});
});
'javascript' 카테고리의 다른 글
[Morriss.js] 그래프에서 legend 만들기 (0) | 2020.06.08 |
---|---|
[dataTables.js] colspan 오류 해결 (0) | 2020.05.20 |
modal 여러개 겹칠 때 z-index 설정하기 (0) | 2020.05.15 |
[dataTables.js] 테이블 스크롤 vertical scrollY (0) | 2020.05.13 |
[dataTables.js] overflow-x scroll (0) | 2020.05.06 |
댓글