Guest User

Untitled

a guest
Jun 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. $(document).ready(function() {
  2. $('<fieldset>').appendTo('body');
  3. $('<div>').addClass('table-title').appendTo('fieldset');
  4. $('<h3>Список: </h3>').appendTo('.table-title');
  5. $('<div>').appendTo('.table-title');
  6. $('<label>Дело: </label>').appendTo('.table-title > div');
  7. $('<input></input>').attr('id', 'text').attr('type', 'text').appendTo('label');
  8. $('<input></input>').attr('id', 'plus').attr('type', 'button').attr('value', 'Добавить').appendTo('label');
  9. $('<table>').height('auto').attr('id', 'myTable').addClass('table-fill').appendTo('fieldset');
  10. $('<tr>').appendTo('table');
  11. $('<th>№</th>').addClass('list_link').appendTo('tr');
  12. $('<th>Описание</th>').addClass('list_link').appendTo('tr');
  13. $('<th>Действие</th>').addClass('list_link').appendTo('tr');
  14.  
  15. var number = 0;
  16.  
  17. $('#plus').click(function(){
  18. number++;
  19. var task = $('#text').val();
  20.  
  21. $('<tr>').appendTo('table');
  22. $('<th></th>').text(number).appendTo('tr:last-child');
  23. $('<th></th>').text(task).addClass('task').appendTo('tr:last-child');
  24. $('<th></th>').appendTo('tr:last-child');
  25. $('<label>Выполнено</label>').appendTo('tr:last-child > th:last-child');
  26. $('<input>').attr('type', 'checkbox').appendTo('tr:last-child > th:last-child');
  27.  
  28. $('input[type = checkbox]').click(function(){
  29. if ($('input:checkbox:checked')) {
  30. $('.task').addClass('thro');
  31. }
  32. })
  33. });
  34. })
  35.  
  36. $('input[type=checkbox]')
  37.  
  38. $('input[type=checkbox]', el)
  39. el.find('input[type=checkbox]')
Add Comment
Please, Sign In to add comment