Difference between #239 and #240 of
Yii v2 snippet guide

Revision #240 has been created by rackycz on Oct 8, 2020, 2:07:47 PM with the memo:

Modal and ajax
« previous (#239) next (#241) »

Changes

Title unchanged

Yii v2 snippet guide

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
]);
echo "<div id='modalContent'></div>";
yii\bootstrap\Modal::end();

$this->registerJs(
  "// If you use $(document).on, it will handle also events on elements rendered by AJAX.  // $(document).on('click','a.openInModal',function(e){   // And if you use $('a.openInModal'), it will work only on standard elements
$('a.openInModal').click(function(e){

// Prevents the browsers default behaviour (such as opening a link)
// ... but does not stop the event from bubbling up the DOM
e.preventDefault();
[...]
7 0
4 followers
Viewed: 255 167 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: 5 months ago
Update Article

Revisions

View all history