I have a page with a table. In tbody I show data through angularjs . In thead , I have the same row as in tbody , but it is empty, and when I filled in the input field and click somewhere (loss of focus), one row adds my table ( thead ). And I need to make some flag on the filled line, as if - rowAdded = true , because without it I click on the input of one line and adds the lines. And another problem is that the rows are added to the end of the table . it all works on this script:
var tbody = $('.table-timesheet thead'); tbody.on('blur', ':text', function () { var tr = $(this).closest('tr'), notEmpty = $(':text', tr).filter(function () { return $.trim($(this).val()) != ''; }).length; if (notEmpty) { $('.note-input').css('width', '88%').css('float', 'left'); $('.timesheet-delete-button').css('display', 'block');
My plunker has my example: http://plnkr.co/edit/rcnwv0Ru8Hmy7Jrf9b1C?p=preview
source share