Advertisement
LegoDrifter

Shabloni ADD/RECEIVE

Dec 23rd, 2020
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. $(document).ready(function () {
  2.  
  3. $(document).tooltip({})
  4.  
  5. $("#add").click(function () {
  6. $("#new_student").dialog("open")
  7. })
  8.  
  9. $("#new_student").dialog({
  10. autoOpen: false,
  11. modal: true,
  12. buttons:{
  13. Add : function () {
  14. var student = $("#student_name").val() + " " + $("#student_index").val()
  15. $("#list_students").append("<li>"+student+"</li>")
  16. $("#new_student").dialog("close")
  17. }
  18. }
  19. })
  20.  
  21. $("#list_students").sortable({
  22. connectWith: "#test_students"
  23. })
  24.  
  25. $("#test_students").sortable({
  26. receive: function( event, ui ) {
  27. $student = $(ui.item)
  28. $("#student_points").dialog("open")
  29. }
  30. })
  31.  
  32. $("#student_points").dialog({
  33. autoOpen: false,
  34. modal: true,
  35. buttons:{
  36. Add : function () {
  37. var points = $("#points").val()
  38. $student.attr("title", points)
  39. $("#student_points").dialog("close")
  40. }
  41. }
  42. })
  43.  
  44. })
  45.  
  46.  
  47. <!DOCTYPE html>
  48. <html>
  49. <head>
  50. <meta charset="UTF-8">
  51. <title>Title</title>
  52. <link rel="stylesheet" href="jquery/jquery-ui.css">
  53. <script src="jquery/jquery.js"></script>
  54. <script src="jquery/jquery-ui.js"></script>
  55. <script src="script.js"></script>
  56. <style>
  57. </style>
  58. </head>
  59. <body>
  60. <h3>Студенти кои го запишале предметот</h3>
  61. <ul id="list_students">
  62. <li>Student Student1 190990</li>
  63. <li>Student Student2 190991</li>
  64. <li>Student Student3 190993</li>
  65. </ul>
  66.  
  67. <button id="add">Додати студент</button>
  68.  
  69. <h3>Студенти кои го полагале тестот</h3>
  70. <ul id="test_students">
  71. <li title="50">Student Student1 190990</li>
  72. <li title="55">Student Student2 190991</li>
  73. <li title="70">Student Student3 190993</li>
  74. </ul>
  75.  
  76. <div id="new_student">
  77. <h3>Внеси име на студентот</h3>
  78. <input type="text" id="student_name">
  79. <h3>Внеси индекс</h3>
  80. <input type="text" id="student_index">
  81. </div>
  82.  
  83. <div id="student_points">
  84. <h3>Внеси поени од тестот</h3>
  85. <input type="number" id="points">
  86. </div>
  87.  
  88. </body>
  89. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement