从JSON数据到模态窗口HTML

huangapple go评论89阅读模式
英文:

Data from json to modal window html

问题

以下是您要翻译的内容:

I need to display information from json in HTML modal window. I have 12 buttons and when user clicks on it I want to show data of this month from json file.

  1. let myJson;
  2. $(`button`).on(`click`, function() {
  3. let id_popup = this.attributes[`data-id`].value;
  4. $.getJSON(`content/js/monthjson.json`, function(months) {
  5. let month = Object.values(months).filter(function(data) {
  6. return data.id === id_popup;
  7. });
  8. $(`.modal-title`).text(month.georgiamonth);
  9. $(`.modal-body`).html(month.description);
  10. });
  11. });
  12. myJson = {
  13. "months": [{
  14. "id": 1,
  15. "georgiamonth": "Jan",
  16. "description": "description Jan month",
  17. "suggestmonths": ""
  18. },
  19. {
  20. "id": 2,
  21. "georgiamonth": "Feb",
  22. "description": "description Feb month",
  23. "suggestmonths": ""
  24. },
  25. {
  26. "id": 3,
  27. "georgiamonth": "Mar",
  28. "description": "description mar month",
  29. "suggestmonths": ""
  30. },
  31. {
  32. "id": 4,
  33. "georgiamonth": "April",
  34. "description": "",
  35. "suggestmonths": "description April month"
  36. },
  37. {
  38. "id": 5,
  39. "georgiamonth": "May",
  40. "description": "description May month",
  41. "suggestmonths": ""
  42. },
  43. {
  44. "id": 6,
  45. "georgiamonth": "June",
  46. "description": "description June month",
  47. "suggestmonths": ""
  48. },
  49. {
  50. "id": 7,
  51. "georgiamonth": "July",
  52. "description": "description July month",
  53. "suggestmonths": ""
  54. },
  55. {
  56. "id": 8,
  57. "georgiamonth": "Aug",
  58. "description": "description Aug month",
  59. "suggestmonths": ""
  60. },
  61. {
  62. "id": 9,
  63. "georgiamonth": "Sept",
  64. "description": "description Sept month",
  65. "suggestmonths": ""
  66. },
  67. {
  68. "id": 10,
  69. "georgiamonth": "Oct",
  70. "description": "description Oct month",
  71. "suggestmonths": ""
  72. },
  73. {
  74. "id": 11,
  75. "georgiamonth": "Nov",
  76. "description": "description Nov month",
  77. "suggestmonths": ""
  78. },
  79. {
  80. "id": 12,
  81. "georgiamonth": "Dec",
  82. "description": "description Dec month",
  83. "suggestmonths": ""
  84. }
  85. ]
  86. }
  1. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  2. <button type="button" class="get-month-data btn btn-outline-danger btn-sm btn-block get-month-id" data-toggle="modal" data-target="#modelId" data-id="1">Show id 1</button>
  3. <button type="button" class="get-month-data btn btn-outline-info btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="2">Show id 2</button>
  4. <button type="button" class="get-month-data btn btn-outline-warning btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="3">Show id 3</button>
  5. <button type="button" class="get-month-data btn btn-outline-success btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="4">Show id 4</button>
  6. <button type="button" class="get-month-data btn btn-outline-danger btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="5">Show id 5</button>
  7. <button type="button" class="get-month-data btn btn-outline-info btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="6">Show id 6</button>
  8. <button type="button" class="get-month-data btn btn-outline-warning btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="7">Show id 7</button>
  9. <button type="button" class="get-month-data btn btn-outline-success btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="8">Show id 8</button>
  10. <button type="button" class="get-month-data btn btn-outline-danger btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="9">Show id 9</button>
  11. <button type="button" class="get-month-data btn btn-outline-info btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="10">Show id 10</button>
  12. <button type="button" class="get-month-data btn btn-outline-warning btn-sm btn-block" data-toggle="modal" data-target="#modelId" data-id="11">Show id 11</button>
  13. <button type="button" id="btn" class="get-month-data btn btn-outline-success btn-sm btn-block" data-toggle="modal" data-id="12" data-target="#modelId">Show id 12</button>
  14. <div class="modal fade" id="modelId" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
  15. <div class="modal-dialog" role="document">
  16. <div class="modal-content">
  17. <div class="modal-header">
  18. <h5 class="modal-title"> month title here </h5>
  19. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  20. <span aria-hidden="true">&times;</span>
  21. </button>
  22. </div>
  23. <div class="modal-body">
  24. description here
  25. </div>
  26. <div class="modal-footer">
  27. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <script src="https://code.jquery.com/jquery-3.6.3.js" integrity="sha256-nQLuAZGRRcILA+6dMBOvcRh5Pe310sBpanc6+QBmyVM" crossorigin="anonymous"></script>
  33. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  34. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZU
  35. <details>
  36. <summary>英文:</summary>
  37. I need to display information from json in HTML modal window. I have 12 buttons and when user clicks on it I want to show data of this month from json file.
  38. &lt;!-- begin snippet: js hide: false console: true babel: false --&gt;
  39. &lt;!-- language: lang-js --&gt;
  40. let myJson;
  41. $(`button`).on(`click`, function() {
  42. let id_popup = this.attributes[`data-id`].value;
  43. $.getJSON(`content/js/monthjson.json`, function(months) {
  44. let month = Object.values(months).filter(function(data) {
  45. return data.id === id_popup;
  46. });
  47. $(`.modal-title`).text(month.georgiamonth);
  48. $(`.modal-body`).html(month.description);
  49. });
  50. });
  51. myJson = {
  52. &quot;months&quot;: [{
  53. &quot;id&quot;: 1,
  54. &quot;georgiamonth&quot;: &quot;Jan&quot;,
  55. &quot;description&quot;: &quot;description Jan month&quot;,
  56. &quot;suggestmonths&quot;: &quot;&quot;
  57. },
  58. {
  59. &quot;id&quot;: 2,
  60. &quot;georgiamonth&quot;: &quot;Feb&quot;,
  61. &quot;description&quot;: &quot;description Feb month&quot;,
  62. &quot;suggestmonths&quot;: &quot;&quot;
  63. },
  64. {
  65. &quot;id&quot;: 3,
  66. &quot;georgiamonth&quot;: &quot;Mar&quot;,
  67. &quot;description&quot;: &quot;description mar month&quot;,
  68. &quot;suggestmonths&quot;: &quot;&quot;
  69. },
  70. {
  71. &quot;id&quot;: 4,
  72. &quot;georgiamonth&quot;: &quot;April&quot;,
  73. &quot;description&quot;: &quot;&quot;,
  74. &quot;suggestmonths&quot;: &quot;description April month&quot;
  75. },
  76. {
  77. &quot;id&quot;: 5,
  78. &quot;georgiamonth&quot;: &quot;May&quot;,
  79. &quot;description&quot;: &quot;description May month&quot;,
  80. &quot;suggestmonths&quot;: &quot;&quot;
  81. },
  82. {
  83. &quot;id&quot;: 6,
  84. &quot;georgiamonth&quot;: &quot;June&quot;,
  85. &quot;description&quot;: &quot;description June month&quot;,
  86. &quot;suggestmonths&quot;: &quot;&quot;
  87. },
  88. {
  89. &quot;id&quot;: 7,
  90. &quot;georgiamonth&quot;: &quot;July&quot;,
  91. &quot;description&quot;: &quot;description July month&quot;,
  92. &quot;suggestmonths&quot;: &quot;&quot;
  93. },
  94. {
  95. &quot;id&quot;: 8,
  96. &quot;georgiamonth&quot;: &quot;Aug&quot;,
  97. &quot;description&quot;: &quot;description Aug month&quot;,
  98. &quot;suggestmonths&quot;: &quot;&quot;
  99. },
  100. {
  101. &quot;id&quot;: 9,
  102. &quot;georgiamonth&quot;: &quot;Sept&quot;,
  103. &quot;description&quot;: &quot;description Sept month&quot;,
  104. &quot;suggestmonths&quot;: &quot;&quot;
  105. },
  106. {
  107. &quot;id&quot;: 10,
  108. &quot;georgiamonth&quot;: &quot;Oct&quot;,
  109. &quot;description&quot;: &quot;description Oct month&quot;,
  110. &quot;suggestmonths&quot;: &quot;&quot;
  111. },
  112. {
  113. &quot;id&quot;: 11,
  114. &quot;georgiamonth&quot;: &quot;Nov&quot;,
  115. &quot;description&quot;: &quot;description Nov month&quot;,
  116. &quot;suggestmonths&quot;: &quot;&quot;
  117. },
  118. {
  119. &quot;id&quot;: 12,
  120. &quot;georgiamonth&quot;: &quot;Dec&quot;,
  121. &quot;description&quot;: &quot;description Dec month&quot;,
  122. &quot;suggestmonths&quot;: &quot;&quot;
  123. }
  124. ]
  125. }
  126. &lt;!-- language: lang-html --&gt;
  127. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css&quot; integrity=&quot;sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T&quot; crossorigin=&quot;anonymous&quot;&gt;
  128. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-danger btn-sm btn-block get-month-id&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;1&quot;&gt;Show id 1&lt;/button&gt;
  129. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-info btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;2&quot;&gt;Show id 2&lt;/button&gt;
  130. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-warning btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;3&quot;&gt;Show id 3&lt;/button&gt;
  131. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-success btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;4&quot;&gt;Show id 4&lt;/button&gt;
  132. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-danger btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;5&quot;&gt;Show id 5&lt;/button&gt;
  133. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-info btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;6&quot;&gt;Show id 6&lt;/button&gt;
  134. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-warning btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;7&quot;&gt;Show id 7&lt;/button&gt;
  135. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-success btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;8&quot;&gt;Show id 8&lt;/button&gt;
  136. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-danger btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;9&quot;&gt;Show id 9&lt;/button&gt;
  137. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-info btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;10&quot;&gt;Show id 10&lt;/button&gt;
  138. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-warning btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;11&quot;&gt;Show id 11&lt;/button&gt;
  139. &lt;button type=&quot;button&quot; id=&quot;btn&quot; class=&quot;get-month-data btn btn-outline-success btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-id=&quot;12&quot; data-target=&quot;#modelId&quot;&gt;Show id 12&lt;/button&gt;
  140. &lt;div class=&quot;modal fade&quot; id=&quot;modelId&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot; aria-labelledby=&quot;modelTitleId&quot; aria-hidden=&quot;true&quot;&gt;
  141. &lt;div class=&quot;modal-dialog&quot; role=&quot;document&quot;&gt;
  142. &lt;div class=&quot;modal-content&quot;&gt;
  143. &lt;div class=&quot;modal-header&quot;&gt;
  144. &lt;h5 class=&quot;modal-title&quot;&gt; month title here &lt;/h5&gt;
  145. &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot; aria-label=&quot;Close&quot;&gt;
  146. &lt;span aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/span&gt;
  147. &lt;/button&gt;
  148. &lt;/div&gt;
  149. &lt;div class=&quot;modal-body&quot;&gt;
  150. description here
  151. &lt;/div&gt;
  152. &lt;div class=&quot;modal-footer&quot;&gt;
  153. &lt;button type=&quot;button&quot; class=&quot;btn btn-secondary&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;
  154. &lt;/div&gt;
  155. &lt;/div&gt;
  156. &lt;/div&gt;
  157. &lt;/div&gt;
  158. &lt;script src=&quot;https://code.jquery.com/jquery-3.6.3.js&quot; integrity=&quot;sha256-nQLuAZGRRcILA+6dMBOvcRh5Pe310sBpanc6+QBmyVM=&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  159. &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  160. &lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot; integrity=&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  161. &lt;!-- end snippet --&gt;
  162. </details>
  163. # 答案1
  164. **得分**: 0
  165. 以下是您要翻译的内容:
  166. "First, you seem to be using backticks instead of apostrophes in your jQuery selectors and elsewhere. That&#39;s not standard, and while it may work I recommend against it if only for reasons of convention. I&#39;ve made the conversion here.
  167. Then, rather than adding a click handler we&#39;ll just use Bootstrap&#39;s modal show event, getting the ID from the `relatedTarget` on the event.
  168. Finally, we&#39;ll use the `find()` method to get the corresponding data object from the array.
  169. Bonus tip: Get your data just once on page load instead of every time a button is clicked. That is, if you don&#39;t expect the data to change frequently."
  170. 请注意代码部分没有被翻译只翻译了文本内容
  171. <details>
  172. <summary>英文:</summary>
  173. First, you seem to be using backticks instead of apostrophes in your jQuery selectors and elsewhere. That&#39;s not standard, and while it may work I recommend against it if only for reasons of convention. I&#39;ve made the conversion here.
  174. Then, rather than adding a click handler we&#39;ll just use Bootstrap&#39;s modal show event, getting the ID from the `relatedTarget` on the event.
  175. Finally, we&#39;ll use the `find()` method to get the corresponding data object from the array.
  176. Bonus tip: Get your data just once on page load instead of every time a button is clicked. That is, if you don&#39;t expect the data to change frequently.
  177. &lt;!-- begin snippet: js hide: false console: true babel: false --&gt;
  178. &lt;!-- language: lang-js --&gt;
  179. let myJson;
  180. $(&#39;#modelId&#39;).on(&#39;show.bs.modal&#39;, function(event) {
  181. const id_popup = event.relatedTarget.getAttribute(&#39;data-id&#39;);
  182. // $.getJSON(&#39;content/js/monthjson.json&#39;, function(months) {
  183. const month = myJson.months.find(el =&gt; el.id == id_popup);
  184. $(&#39;.modal-title&#39;).text(month.georgiamonth);
  185. $(&#39;.modal-body&#39;).html(month.description);
  186. // });
  187. });
  188. myJson = {
  189. &quot;months&quot;: [{
  190. &quot;id&quot;: 1,
  191. &quot;georgiamonth&quot;: &quot;Jan&quot;,
  192. &quot;description&quot;: &quot;description Jan month&quot;,
  193. &quot;suggestmonths&quot;: &quot;&quot;
  194. },
  195. {
  196. &quot;id&quot;: 2,
  197. &quot;georgiamonth&quot;: &quot;Feb&quot;,
  198. &quot;description&quot;: &quot;description Feb month&quot;,
  199. &quot;suggestmonths&quot;: &quot;&quot;
  200. },
  201. {
  202. &quot;id&quot;: 3,
  203. &quot;georgiamonth&quot;: &quot;Mar&quot;,
  204. &quot;description&quot;: &quot;description mar month&quot;,
  205. &quot;suggestmonths&quot;: &quot;&quot;
  206. },
  207. {
  208. &quot;id&quot;: 4,
  209. &quot;georgiamonth&quot;: &quot;April&quot;,
  210. &quot;description&quot;: &quot;&quot;,
  211. &quot;suggestmonths&quot;: &quot;description April month&quot;
  212. },
  213. {
  214. &quot;id&quot;: 5,
  215. &quot;georgiamonth&quot;: &quot;May&quot;,
  216. &quot;description&quot;: &quot;description May month&quot;,
  217. &quot;suggestmonths&quot;: &quot;&quot;
  218. },
  219. {
  220. &quot;id&quot;: 6,
  221. &quot;georgiamonth&quot;: &quot;June&quot;,
  222. &quot;description&quot;: &quot;description June month&quot;,
  223. &quot;suggestmonths&quot;: &quot;&quot;
  224. },
  225. {
  226. &quot;id&quot;: 7,
  227. &quot;georgiamonth&quot;: &quot;July&quot;,
  228. &quot;description&quot;: &quot;description July month&quot;,
  229. &quot;suggestmonths&quot;: &quot;&quot;
  230. },
  231. {
  232. &quot;id&quot;: 8,
  233. &quot;georgiamonth&quot;: &quot;Aug&quot;,
  234. &quot;description&quot;: &quot;description Aug month&quot;,
  235. &quot;suggestmonths&quot;: &quot;&quot;
  236. },
  237. {
  238. &quot;id&quot;: 9,
  239. &quot;georgiamonth&quot;: &quot;Sept&quot;,
  240. &quot;description&quot;: &quot;description Sept month&quot;,
  241. &quot;suggestmonths&quot;: &quot;&quot;
  242. },
  243. {
  244. &quot;id&quot;: 10,
  245. &quot;georgiamonth&quot;: &quot;Oct&quot;,
  246. &quot;description&quot;: &quot;description Oct month&quot;,
  247. &quot;suggestmonths&quot;: &quot;&quot;
  248. },
  249. {
  250. &quot;id&quot;: 11,
  251. &quot;georgiamonth&quot;: &quot;Nov&quot;,
  252. &quot;description&quot;: &quot;description Nov month&quot;,
  253. &quot;suggestmonths&quot;: &quot;&quot;
  254. },
  255. {
  256. &quot;id&quot;: 12,
  257. &quot;georgiamonth&quot;: &quot;Dec&quot;,
  258. &quot;description&quot;: &quot;description Dec month&quot;,
  259. &quot;suggestmonths&quot;: &quot;&quot;
  260. }
  261. ]
  262. };
  263. &lt;!-- language: lang-html --&gt;
  264. &lt;link rel=&quot;stylesheet&quot; href=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css&quot; integrity=&quot;sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T&quot; crossorigin=&quot;anonymous&quot;&gt;
  265. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-danger btn-sm btn-block get-month-id&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;1&quot;&gt;Show id 1&lt;/button&gt;
  266. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-info btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;2&quot;&gt;Show id 2&lt;/button&gt;
  267. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-warning btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;3&quot;&gt;Show id 3&lt;/button&gt;
  268. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-success btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;4&quot;&gt;Show id 4&lt;/button&gt;
  269. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-danger btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;5&quot;&gt;Show id 5&lt;/button&gt;
  270. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-info btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;6&quot;&gt;Show id 6&lt;/button&gt;
  271. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-warning btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;7&quot;&gt;Show id 7&lt;/button&gt;
  272. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-success btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;8&quot;&gt;Show id 8&lt;/button&gt;
  273. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-danger btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;9&quot;&gt;Show id 9&lt;/button&gt;
  274. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-info btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;10&quot;&gt;Show id 10&lt;/button&gt;
  275. &lt;button type=&quot;button&quot; class=&quot;get-month-data btn btn-outline-warning btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modelId&quot; data-id=&quot;11&quot;&gt;Show id 11&lt;/button&gt;
  276. &lt;button type=&quot;button&quot; id=&quot;btn&quot; class=&quot;get-month-data btn btn-outline-success btn-sm btn-block&quot; data-toggle=&quot;modal&quot; data-id=&quot;12&quot; data-target=&quot;#modelId&quot;&gt;Show id 12&lt;/button&gt;
  277. &lt;div class=&quot;modal fade&quot; id=&quot;modelId&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot; aria-labelledby=&quot;modelTitleId&quot; aria-hidden=&quot;true&quot;&gt;
  278. &lt;div class=&quot;modal-dialog&quot; role=&quot;document&quot;&gt;
  279. &lt;div class=&quot;modal-content&quot;&gt;
  280. &lt;div class=&quot;modal-header&quot;&gt;
  281. &lt;h5 class=&quot;modal-title&quot;&gt; month title here &lt;/h5&gt;
  282. &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot; aria-label=&quot;Close&quot;&gt;
  283. &lt;span aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/span&gt;
  284. &lt;/button&gt;
  285. &lt;/div&gt;
  286. &lt;div class=&quot;modal-body&quot;&gt;
  287. description here
  288. &lt;/div&gt;
  289. &lt;div class=&quot;modal-footer&quot;&gt;
  290. &lt;button type=&quot;button&quot; class=&quot;btn btn-secondary&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;
  291. &lt;/div&gt;
  292. &lt;/div&gt;
  293. &lt;/div&gt;
  294. &lt;/div&gt;
  295. &lt;script src=&quot;https://code.jquery.com/jquery-3.6.3.js&quot; integrity=&quot;sha256-nQLuAZGRRcILA+6dMBOvcRh5Pe310sBpanc6+QBmyVM=&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  296. &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  297. &lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot; integrity=&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  298. &lt;!-- end snippet --&gt;
  299. </details>

huangapple
  • 本文由 发表于 2023年2月14日 02:05:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75439655.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定