This question might be a duplicate but I did not know any good key words to search for to find the solution I am looking for.
I am working on a website which shows a table to the user. In one column the table contains notes that the user can edit. To do so, I added a button for every row in that column to open a bootstrap modal dialog where the user can edit the note associated with the specific row. I also have a JavaScript-function "saveNote(recordId)" which reads the entered text from the input field in the modal dialog and then sends it to the server via an ajax post.
Now my question is: How and where can I store the id of the row that is currently being edited so that I can pass it to the saveNote()-function? I found an example in the bootstrap documentation but that only covers passing data dynamically to the modal dialog (Varying modal content). Is there any common way to do this in a modal dialog or do I need a global variable for that in JavaScript?
idin thedataattribute of the button in the table, then bind to theshow.bs.modalevent. From there get the value of thedataattribute from the button, then pass it to the button from the modal for thesaveNote()to use. Although, it would be nice if you add some codes so that we can properly know what to do - Carl Binalladataattribute using JQuery - Carl Binalla