Guest User

Untitled

a guest
Jul 11th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. <table class="table table-bordered" id="tabla">
  2. <thead>
  3. <th>#</th>
  4. <th>Requisito</th>
  5. <th>Fecha completado</th>
  6. <th>Completado</th>
  7. <th>Observacion</th>
  8. </thead>
  9. <tbody id="t_cuerpo">
  10. <tr>
  11. <td>1</td>
  12. <td>Ceremonia de bienvenida</td>
  13. <td><input type="text" id="fecha" class="form-control"></td>
  14. <td><select name="" id="estado" class="form-control">
  15. <option value="si">si</option>
  16. <option value="no">no</option>
  17. </select></td>
  18. <td><textarea name="" id="obs" cols="20" rows="2" class="form-control"></textarea></td>
  19. </tr>
  20. <tr>
  21. <td>2</td>
  22. <td>Sermon nocturno</td>
  23. <td><input type="text" id="fecha" class="form-control"></td>
  24. <td><select name="" id="estado" class="form-control">
  25. <option value="si">si</option>
  26. <option value="no">no</option>
  27. </select></td>
  28. <td><textarea name="" id="obs" cols="20" rows="2" class="form-control"></textarea></td>
  29. </tr>
  30. </tbody>
  31. </table>
  32. <div id="mostrar"></div>
  33. <button type="button" id="obtener">Obtener</button>
  34.  
  35. $(document).ready(function () {
  36. crearDatos();
  37. });
  38.  
  39. function crearDatos() {
  40. var listaRequisitos = [];
  41. $('#t_cuerpo tr').each(function () {
  42. listaRequisitos.push(
  43. { id: $(this).find('td').eq(0).html(),
  44. descri: $(this).find('td').eq(1).html(),
  45. fecha: $(this).find('td').eq(2).html(),
  46. estado: $(this).find('td').eq(3).html()
  47. }
  48. );
  49. });
  50.  
  51. jsonRequisitos = JSON.stringify(listaRequisitos);
  52.  
  53. $('#obtener').click(function () {
  54. $('#mostrar').html(jsonRequisitos);
  55. });
  56.  
  57. }
Add Comment
Please, Sign In to add comment