title: Bootstrap: Modal dialog for editing data dynamically
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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 (<a href="https://getbootstrap.com/docs/4.0/components/modal/#varying-modal-content" rel="nofollow noreferrer">Varying modal content</a>). Is there any common way to do this in a modal dialog or do I need a global variable for that in JavaScript?</p>