Created
June 14, 2019 08:36
-
-
Save milinmestry/f361d1d955be6822d2f595080735a7c9 to your computer and use it in GitHub Desktop.
Bootstrap Modal data attributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h2. My Observation on Bootstrap Modal data attributes | |
======= | |
I have added to data-* attributes for Modal window to pass data on to display. | |
Data attributes are- | |
#data-fyid | |
#data-fyHead | |
In the JavaScript code- | |
` | |
$('#fy_modal').on('show.bs.modal', function (event) { | |
let button = $(event.relatedTarget) // Button that triggered the modal | |
let fyid = button.data('fyid') // This give me the actual integer ID in modal | |
// let fyhead = button.data('fyHead'); // This will return value as undefined | |
let fyhead = button.data('fyhead'); // This will return correct value | |
.... | |
}); | |
` | |
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. | |
I learn that camelcase is not supported in Bootstrap modal to pass data via attributes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment