Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. h2. My Observation on Bootstrap Modal data attributes
  2. =======
  3.  
  4. I have added to data-* attributes for Modal window to pass data on to display.
  5. Data attributes are-
  6. #data-fyid
  7. #data-fyHead
  8.  
  9. In the JavaScript code-
  10. `
  11. $('#fy_modal').on('show.bs.modal', function (event) {
  12. let button = $(event.relatedTarget) // Button that triggered the modal
  13. let fyid = button.data('fyid') // This give me the actual integer ID in modal
  14. // let fyhead = button.data('fyHead'); // This will return value as undefined
  15. let fyhead = button.data('fyhead'); // This will return correct value
  16. ....
  17. });
  18. `
  19.  
  20. So to get the value for **data-fyHead** attribute, I have to chage the case of the variable to **data-fyhead**, this solve my problem.
  21. I learn that camelcase is not supported in Bootstrap modal to pass data via attributes.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement