2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-14 18:42:30 +03:00

Remove jQuery from docs/repo.

Some of the snippets need to be updated later.
This commit is contained in:
XhmikosR
2019-02-19 16:19:02 +02:00
parent 1da5b9f76a
commit 7f7f858cb9
23 changed files with 30 additions and 58 deletions
+4 -3
View File
@@ -498,7 +498,7 @@ Utilize the Bootstrap grid system within a modal by nesting `.container-fluid` w
### Varying modal content
Have a bunch of buttons that all trigger the same modal with slightly different contents? Use `event.relatedTarget` and [HTML `data-*` attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes) (possibly [via jQuery](https://api.jquery.com/data/)) to vary the contents of the modal depending on which button was clicked.
Have a bunch of buttons that all trigger the same modal with slightly different contents? Use `event.relatedTarget` and [HTML `data-*` attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes) to vary the contents of the modal depending on which button was clicked.
Below is a live demo followed by example HTML and JavaScript. For more information, [read the modal events docs](#events) for details on `relatedTarget`.
@@ -542,8 +542,9 @@ Below is a live demo followed by example HTML and JavaScript. For more informati
$('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
// If necessary, you could initiate an AJAX request here
// and then do the updating in a callback.
// Update the modal's content.
var modal = $(this)
modal.find('.modal-title').text('New message to ' + recipient)
modal.find('.modal-body input').val(recipient)